Wednesday 15 September 2010

angularjs - Required angular directive not found -



angularjs - Required angular directive not found -

i trying understand execution of link function in angular directives. however, stuck in simple setup. next html code:

<!doctype html> <html ng-app="demoapp"> <body> <div ng-controller="democontroller" class="container"> <directiveone directivetwo ></directiveone> </div> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script src="app.js"></script> </body> </html>

"demoapp" defined in app.js follows:

angular.module('demoapp', []) .controller("democontroller", function(){ }) .directive("directiveone", function(){ var linker = function(scope, element, attrs){ console.log("directiveone link called"); }; homecoming { link : linker } }) .directive("directivetwo", function(){ var linker = function(scope, element, attrs){ console.log("directivetwo link called"); }; homecoming { require: "directiveone", link : linker }; });

when run code, error:

controller 'directiveone', required directive 'directivetwo', can't found!

i unable figure out error here. documentation suggests might typo, not apparent me.

directives default attribute-only. directiveone directive isn't beingness picked - need specify restrict: 'e' in definition, or apply attribute (<div directiveone directivetwo>...)

angularjs angularjs-directive

No comments:

Post a Comment