javascript - Failing to inject an angular component -


so trying here make angular component , injected angular app. here code angular component:

(function(angular) { 'use strict';  angular.module('some.somemodule', ['bm.component.templates']) .directive('somesomemodule', somesomemodule);  somesomemodule.$inject = []; function somesomemodule() {     return {         restrict:'ea',         templateurl : 'components/document_preview/document-preview1.html'     }; } })(window.angular); 

i have app.js inject new component app module.

 var someapp = angular.module('some.app', [     'bm.component.templates',     'some.hello',     'some.somemodule', ]) .config(config) .run(run); 

i console:

enter image description here strange thing have some.hello angular component same sort of code , working fine. how fix this? appreciated.

you not declaring custom module dependency of application module.

please try following :

 var someapp = angular.module('some.app', [     'bm.component.templates',     'some.hello',     'some.documentpreview',     'some.somemodule' ]) .config(config) .run(run); 

edit #1:

try wrapping angular module code in iffe did custom 1 :

(function (angular) {     var someapp = angular.module('some.app', [             'bm.component.templates',             'some.hello',             'some.documentpreview',             'some.somemodule'         ])         .config(config)         .run(run); })(window.angular); 

edit #2: here's code working.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -