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-model="city"></div>
</body>
JavaScript
var app = angular.module('directiveApp', []);
app.directive('ngSparkline', function() {
return {
restrict: 'A',
require: '^ngModel',
scope: {
ngModel: '='
},
template: '<div class="sparkline"><h4>Weather for {{ngModel}}</h4></div>'
}
});