I have a web application into which another widget should be integrated. The widget script is loaded asynchronously and takes around 10 sec to load.I want to add this widget module as a dependency in my angular application after the relevant scripts are loaded. Is this actually feasible? I am using ng-app to bootstrap my application.In another comment, I found that dynamic injection of modules is possible only before bootstraping the application.Is there any workaround for this or is this bad approach altogether?
Edit: The application should not be dependent on the loading of widget since it is only an integration.As many people have suggested, when i use requireJS,it forces the bootstrap of application to wait till the widget loads. Is there any way to handle this?
-
Have you checked out require.js?Satej S– Satej S2016年02月23日 07:08:27 +00:00Commented Feb 23, 2016 at 7:08
-
stackoverflow.com/questions/12758157/… have you seen this?Zeeshan Hassan Memon– Zeeshan Hassan Memon2016年02月23日 07:08:58 +00:00Commented Feb 23, 2016 at 7:08
-
The question you mentioned deals with injecting a service into my controller. I want to add a new dependency module into my angular application.user1776573– user17765732016年02月23日 07:11:35 +00:00Commented Feb 23, 2016 at 7:11
-
@SatejS require.js is an option but one should have better understanding of both Angular and Require before using them together, Here is another option for lazy loading ify.io/lazy-loading-in-angularjsZeeshan Hassan Memon– Zeeshan Hassan Memon2016年02月23日 07:18:35 +00:00Commented Feb 23, 2016 at 7:18
1 Answer 1
If you can bear requirejs with angularjs then angularAMD is the option:
AngularJS + RequireJS: The Proper and Easier Way
If you choose to go with direct option:
3 Comments
Explore related questions
See similar questions with these tags.