-
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
Run blocks inside lazy loaded files don't get executed #89
Comments
It is not a bug, the run & config blocks are executed when the module is loaded for the first time. |
Ah, ok. It would be useful to mention this in the documentation (about the run blocks). Thanks! |
Hmm I checked, reconfig only works for config. |
I believe if you have multiple run blocks in a file for the same module, not all of them get executed (at least at a first look). I'll test later to be sure. Thanks and sorry for being a pain in the ass :) |
Eheh no problem, it's cool when someone find edge cases like this and takes the time to make a bugged version online that I can inspect and fix. And the run blocks should all be executed, there is a foreach loop. |
It's available in 0.4.0 ! |
Woops there is a bug, a new run block will be added each time and they will all be runed (1 block the first time, 2 blocks the second time, ...). |
I discovered a problem regarding register function. If you load multiple modules, when register function is called in |
Hmmm I have a problem: the There are two use case:
Do you think that I should store the old run blocks, and if there is the rerun parameter but that no new run block has been defined I should use the previous run block ? As for the params remaining instantiated, I'll take a look, thanks. |
I'm not sure I've understood the problem but from my point of view, when using angularjs as it is, run blocks are meant to be executed only once after module's has been configured. So in my opinion, a run block should be executed only once, otherwise, I suppose it's bad design. But you can choose any approach you think is the best and wait for other's opinions. |
Ok both problems are fixed in 0.4.1 ! Damn, 3 releases in one day :) |
It's me again :) Rerun not working anymore. Check http://deiweb.net/ocLazyLoad/ |
Damn ! What did I dooooo ? edit: ok it's because of the params, the rerun param from the config object is not extended into the param object (that means that it would probably have failed with requirejs too !) |
Ok, can you check master please? And if it's good I'll make yet another release :) |
Ok time to go to bed, I released 0.4.2 (let's hope everything is ok this time). I really should take the time to do those unit tests... |
It works now 👍 |
I am still running into this problem, in the guise of the issue cited in the linked bug report for Webpack's
I tried it without the |
@amaschas did you get anywhere with this? |
@jwhitmarsh unfortunately no, we actually abandoned Angular entirely. |
I just had a look at this issue as i depend on it for code splitting. As it seems to me there is the issue that only run block from the new module are executed, while webpack is adding the templates to the "ng" module. Therefor i came up with a strategy to run "ng" run blocks which are newly added after a file load. This could be handled in the core loader i would assume, though it is webpack specific it does not add much overhead to non webpack instances. Here is my solution:
|
If you add the correct module name to the loader, it will also work fine. end use rerun when loading the module: |
Hi,
I've noticed that run blocks defined in lazy loaded files never get executed.
For demo I've put a run block that defines a template into $templateCache but because the specified block never gets executed, when a directive requires the defined template, it fails: "Failed to load template: printCapitalizedLazyLoaded.html"
Demo: http://deiweb.net/ocLazyLoad
Thanks for the awesome job you're doing!
The text was updated successfully, but these errors were encountered: