angularjs - directive not working in its own module -


if declare module in way, receive error : "uncaught error: [$injector:modulerr]"

angular.module('myapp.resumedirectives',[])  .directive('nameresume',[   function(){     return {         restrict: 'ae',         template: '<h1 id="user-name">{{resume.name}} resume </h1>'     };   } ]); 

this code in directive file , code in main file

var myapp=angular.module('myapp', [   // ...   'myapp.resumedirectives' ]); 

if, instead, declare directive way, directive works properly.

myapp.directive('nameresume',[   function(){     return {         restrict: 'ae',         template: '<h1 id="user-name">{{resume.name}} resume </h1>'     };   } ]); 

any ideas?

you'll need create file declaring module such index.js or whatever name want , declare module

angular.module('myapp.resumedirectives',[]); 

then, inject new file script files


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -