ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

Factory method is not a function #267

Open aaronloe opened 8 years ago

aaronloe commented 8 years ago

Hello,

I have a nested state that's attempting to load a module the depends on a module resolved in a parent state like this:

state('root', { views: ... resolve: CommonModule1: function($ocLazyLoad) ... CommonModule2: function($ocLazyLoad)... }).state('root.View', { views: ... resolve: ViewModuleA: function($ocLazyLoad) ...

})

ViewModuleA has several dependencies in it, including CommonModule1 and CommonModule2. When a controller in ViewModuleA gets created, it tries to access one of the public methods defined in a factory in CommonModule1, but when doing so, it errors out and says 'CommonFactory.MethodA is not a function'

However, if i inspect some of the other factories injected into my ViewModuleA's controller, they look fine. Is there anything I'm missing about using modules that are defined in a parent state?

If it helps, when I inspect the problem factory in my controller, it appears to just be an array of strings, with several other modules i'm using in my app listed there, even though they've been resolved already and used successfully by controllers on the parent state.

Any help/tips would be greatly appreciated!!