JSFiddle - React, Tailwind, and code Playground

by justbn

HTML

<body ng-app="directiveApp">
	<input type="text" ng-model="city" placeholder="Enter a city" />
    <div ng-sparkline ng-city="city"></div>
</body>

JavaScript

var app = angular.module('directiveApp', []);

app.directive('ngSparkline', function() {
  return {
    restrict: 'A',
    require: '^ngCity',
    scope: {
      ngCity: '='
    },
    template: '<div class="sparkline"><h4>Weather for {{ngCity}}</h4></div>'
  }
});

app.directive('ngCity', function() {
  return {
    controller: function($scope) {}
  }
});