-
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
Controller not being initialized #33
Comments
Also worth mentioning, I found a good post that combines RequireJS + ocLazyLoader + ui-router - http://plnkr.co/edit/OGvi01?p=preview with a SO article: http://stackoverflow.com/questions/23890623/how-can-i-add-require-js-to-my-angularjs-application |
Did you use the version that I just release a few hours ago or an older one ? |
@gilbox do you mind if I link your plunkr in the doc as an example of a requirejs integration ? |
@ocombe - yes it works with that one ;) https://github.com/ocombe/ocLazyLoad/tree/5b2fb15b5a2a51ffea152f23aed04a6be385cc95 |
Also whats the ideal convention when you have a ui-router route that has 2 separate views with their own controllers such as: http://www.screencast.com/t/yQe1Qwxw1rHb |
@ocombe of course you can use it. I've updated the plunk to 0.3.0. @amcdnl Have you tried it? I don't really think it's a special case. You just have to replace and here's a quick look at the simplified pattern:
... so for each lazily-loaded view you can create another bundle with |
That's a clever way to do this ! I wonder how I could include this into ocLazyLoad to simplify the process, maybe with a function that would return a template by name once it's lazy loaded, and returns a promise in the mean time. |
As for your original issue @amcdnl is it possible to get a copy of the files to debug it ? Maybe a plunkr, or a zip at olivier.combe@gmail.com ? |
I ended up doing this:
|
Ok so this is closed ? By the way you can use the param |
No, not yet. The original issue still happens in the latest code set but not after the commit I started above. |
Well, then is it possible to get a copy of the files to debug it ? Maybe a plunkr, or a zip at olivier.combe@gmail.com ? Otherwhise it will be hard to find the source of the problem :( |
Ya, I'll try to make a plunker for ya this afternoon. |
@ocombe I was thinking about your idea of making it even more integrated. It turns out uiRouter has an extremely powerful decorator method. It allows us to define our states simply like this:
This should work with explicit views (you can define the lazy__ properties in the view object) although I haven't actually tested it. |
What are you guys thoughts on something like this: https://gist.github.com/amcdnl/9900479 |
It looks fine but be careful with angular.module, it will throw an error if the module doesn't exists |
Ya, some better error checking and maybe a manual option would make it pretty useful. |
@ocombe - sorry no idea what i was doing wrong but after fully blowing my app out w/ the previous version i started to make a plunker this morning and when upgraded my solution it works this time :). I did notice 0.3.0 loads things faster feeling, you notice this? |
I did a bit of refractoring/optimizing so it's quite possible yes, but I'm not sure if it should be that perceptible. |
Actually this is still a problem, the reason I thought it was resolved is because I changed my structure but upon doing a refactor to make it more modular it fails. The issue essentially is in the above scenario the controller is never init'd but it is loaded okay. This is such a hard example to duplicate I'm not sure it would be possible to in a simple plunker though. |
Thanks again @amcdnl for your persistence, it should be fixed in 0.3.1 ! |
Thanks!!! When I try to use bower to pull your project I get the following: http://www.screencast.com/t/rgSEWlPGuiZ I never get this with any other bower packages, any ideas? |
https://twitter.com/bower/status/487704111832252417 |
Ah yes ... found it after I posted this hehe |
Your change works! ThankS! |
Hi am trying to lazy load controller definition when a particular state has been reached
when going to that state it is loading that file my table.js is
but I am getting error tableController is not defined |
Hello, change |
It has solved my undefined problem but the value that i have defined under the controller is not reflecting in the html |
I'm trying to lazy load a module. The module is injected and no errors are thrown but the controller never initializes.
My structure looks like:
admin.js
contains the routes for all my modules that fall under the admin folder ( there is much more just shortened here ).On init,
app.js
loads like:in my
admin.js
file I define all the routes for my admin section of my app like:and then in
apps.js
I define the apps module and controller:so everything loads fine and breakpoints are even hit in the
apps.js
file but the controller is never init'd. The ui-view is empty like:am i missing something or is this a bug?
The text was updated successfully, but these errors were encountered: