nothing display when create and use custom directive using angularjs -
i beginner in angularjs , created custom directive. when used custom directive in div tag,nothing id displaying. please below code , suggest me how , mistake did here.
<body ng-app="x"> <div test></div> <div class="any"></div> <script> var app = angular.module("x", []); app.directive("test", function(){ return { restrict: "a" template: "<h1>custom attribute</h1>" } }); app.directive("any", function(){ return { restrict: "c" // class directive template: "custom directive class" } }); </script> </body>
just created fiddle here: https://jsfiddle.net/frishi/nbe9hc32/2/
i not sure errors getting in console, if any. right off bat, missing commas in directive definition object.
.directive("test", function(){ return { restrict: "a", // <- missing comma template: "<h1>custom attribute</h1>" } }) look @ code in fiddle , compare yours it. should fix issue.
Comments
Post a Comment