JSFiddle - React, Tailwind, and code Playground
by gogirl
HTML
<body ng-app='myApp' ng-controller='MyCtrl'>
<p row='rows[0]'></p>
<p row='rows[1]'></p>
</body>
JavaScript
var app = angular.module('myApp', []);
app.controller('MyCtrl', function ($scope) {
$scope.rows = ['Row 1', 'Row 2'];
});
app.directive('myDirective', function () {
return {
template: '{{row}}',
scope: true,
link: function (scope, element, attrs) {
attrs.$observe('row', function (value) {
scope.row = scope.$eval(value);
console.log([row]->,'row');
});
console.log('end');
}
};
});