-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy loading angular.strap components #86
Comments
Hi ! So what you will have to do is load each module independently and in the right order ("mgcrea.ngStrap.typeahead" before "mgcrea.ngStrap"). But you'll have to be careful, because they might depend upon each other. For example: You will have to check the source code to find out all the modules that have no dependencies, load them, and then load the ones that depend upon them, and so on... I wonder if there could be a better way. Since all modules are defined in the bundle file, loading it should make all modules available at once. |
Let's say the problem is not including all the dependencies in the right order. Suppose we have a bundle that contains mgcrea.ngStrap module and all its dependencies & templates. How can I attach the mgcrea.ngStrap module to my app module after loading it (lazy)? If I don't specify ngStrap module from the beginning as a dependent module for my app level module, none of ngStrap components will run. But on the other hand, if I'll specify ngStrap as a dependency, angular will fail instantiating my app module if I don't include all the components from the first place (before bootstrap - like in my first post).
all modules that are defined inside the js bundle, will be pushed as dependencies to myAppModule, therefore everything should compile & run and no will be need to mess with anyone's code. |
Ok, so I tried it with angular strap and the last version from master: it works if you load the module 'mgcrea.ngStrap' (that will load all the other modules) and if you bundle the angular-strap.js and angular-strap.tpl.js together. |
Ok it should work now ! You can use the new parameter
It's available in 0.4.0 ! |
It works! 😗 |
Perfect :) |
Hi,
How can I lazy load components of a module like angular.strap if the module declares its components as dependencies:
If I leave the module defined like above, the app fails to instantiate:
If I remove the dependencies, they load but not compile.
I have a feeling that the only solution is to rewrite all the components so that they all link to same module (e.g.: instead of
angular.module('mgcrea.ngStrap.typeahead').provider('$typeahead')
the provider should be directly defined inangular.module('mgcrea.ngStrap)
) but please tell me I'm wrong... :)So, is there any possibility to lazy load the entire module or parts of it without having to intervene in angular.strap components' code?
Thanks!
The text was updated successfully, but these errors were encountered: