JSFiddle - React, Tailwind, and code Playground
by rur_d
HTML
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
<div ng-app="testApp">
<div test-dir>
<p>Testval = {{testval}}</p>
</div>
<!-- directive: test-com 'hello, world' -->
<p>
{{testval2}}
</p>
</div>
JavaScript
/**
* testApp Module
*
* Description
*/
angular.module('testApp', [])
.directive('testDir', function(){
return{
scope: true,
restrict: "A",
link: function(scope, elm, attrs) {
elm.css("border", "1px solid red");
scope.testval = "hello!";
}
}
})
.directive("testCom", function(){
return {
restrict: "M",
link:function(scope, elm, attrs){
scope.testval2 = attrs.testCom.split(',');
}
}
})