AngularJS: add dependencies to my app before bootstrap it -



AngularJS: add dependencies to my app before bootstrap it -

i working angularjs short amount of time still kind of lost it. sorry if question trivial or asked... have seen many different questions / posts / docs confused.

this problem facing: dynamically add together dependencies app (i going refer rootapp), before bootstrap it. @ moment bootstrap happens manually: have read on web, should possible dynamically add together dependencies app before bootstrap (and why bootstrap happening manually).

i have different templates (powered template toolkit) can load different modules dependency: example, template "mycomponent" needs load, dependency, angular module mycomponent; template "mytable" needs load, dependency, angular module ngtable, etc... define module rootapp as: // note: no dependencies argument! rootappmodule = angular.module('rootapp', []);

and add together dependencies on demand, like:

rootappmodule.pushdependency( mycomponentmodule ); rootappmodule.pushdependency( ngtablemodule );

then bootstrap: angular.bootstrap(document, ['rootappmodule']);

someone can help me?

ps have seen there angular plugins load dependencies after bootstrap of app here happy doing before bootstrap. should easier, prefer avoid (not needed?) complexity.

edit: have found array "requires", follows example: angular.module("rootappmodule").requires.push("mycomponentmodule"); here can tell if reliable solution?

well, in "edit" friend told me habit reply own questions when there answer, here is:

i have found array "requires", follows example: angular.module("rootappmodule").requires.push("mycomponentmodule"); here

anybody can tell if reliable solution? thanks.

angularjs twitter-bootstrap dependencies

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -