JSFiddle - React, Tailwind, and code Playground
by dream apple
HTML
<div ng-app="MyApp"
ng-controller="MyController as vm">
<div ng-repeat="program in vm.programs">
<a href="#" dr="$index">{{program}}</a>
</div>
</div>
JavaScript
(function(){
angular.module("MyApp", [])
.controller("MyController", MyController)
.directive("dr", dr);
MyController.$inject = [];
dr.$inject = [];
function MyController(){
var vm = this;
vm.programs = [0,1,2,3,4,5,6,7,8,9];
}
function dr(){
var directive = {
restrict: "AEC",
link: linkFunc,
scope: {
dr: "="
}
};
return directive;
function linkFunc(scope, ele, attrs){
if(scope.dr == 4 || scope.dr == 9){
ele.text("Dreamapple");
}
}
}
})();