ocLazyLoad icon indicating copy to clipboard operation
ocLazyLoad copied to clipboard

code breaking after moving from 0.5.0 to 1.0.9 version

Open jaspreetsinghmadan opened this issue 8 years ago • 4 comments

In my application i was using ocLazyLoad.load(name: RequiredModule,files: []).then(function () { } to load modules. But when i move to 1.0.9 load function started throwing error "no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'.

so i modified the code to use inject ocLazyLoad.inject(name: RequiredModule,files: []).then(function () { } but i am getting unknown provider error. like I am loading module A which is dependent of module B. And while loading module A service in module B is throwing unknown provider error. The same code is working with load function of 0.5.0. Please suggest what am i missing.

jaspreetsinghmadan avatar Jan 27 '17 22:01 jaspreetsinghmadan

Let me add some more information. Able to resolve the issue with 1.0.9 when we inject along with all dependent module. Let me explain as below : A module is dependent on B in 0.5 i was able to get injector using following code - angular.injector(['ng','A'); But in 1.0.9 it is not working and saying injector is not able to resolve xxx service from B module. if i do the following change it starts working - angular.injector(['ng','B','A']);

vasuneet avatar Jan 30 '17 15:01 vasuneet

Any update on this?

vasuneet avatar Jan 31 '17 09:01 vasuneet

I think this is the related issue (chaining dependency resolving) which is mentioned in the following : https://github.com/ocombe/ocLazyLoad/issues/198 https://github.com/ocombe/ocLazyLoad/issues/214

vasuneet avatar Jan 31 '17 12:01 vasuneet

This occured since 0.6.0. As workarounds, either use requirejs or define the module and its dependencies before loading the file (I'm looking for several plugins container, so that work for me).

thomasraynal avatar May 19 '17 11:05 thomasraynal