philippd / angular-deferred-bootstrap

Initialize your AngularJS app with constants loaded from the back-end.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inject more

eduardoinnorway opened this issue · comments

I would like to inject more than just http, q, timeout etc.. for example $state has all the routing information and that is information you might want to use for pre bootstraping things based on the rout schema.

You can do this by using the injector modules feature:

https://github.com/philippd/angular-deferred-bootstrap#custom-injector-modules

Just add ui-router as injector module and and inject $state in your resolve function.

Does not work with $state as described... look this plunkr, f12 and you see the exceptions.
The actual code is in init.js for the pre bootstraping with your module.

http://plnkr.co/edit/dJrR3H?p=preview