angularjs - ui-router $urlRouterProvider wait until all states loaded -


i'm trying dynamically load bunch of states, merging them disperse files.

i'm collecting of them $http.get , add $stateprovider.state(name, config).

all ok here.

the problem if enter url, besides root url "/", same url never resolved correct state.

it seems that, if load app root state , navigate there, $urlrouterprovider can match loaded states, but, if try enter app child state, example "/#/anotherpage", cannot match url/state , fallback .otherwise('/').

it's if tries resolve url without waiting states loaded.

i'm using $urlrouterprovider.deferintercept() try stop continue, , after configuration, enable again sync.

app.config(configure).run(['$urlrouter', function($urlrouter){         $urlrouter.sync();         $urlrouter.listen();     }]); 

how make sure $urlrouterprovider waits until states loaded during .config(), , try match correct state?

thanks.

i'm not sure had related i'll post : creating object in config phase. object configuration overridable couldn't built state in config phase of provider. moved $stateprovider calls , $urlrouterproviders calls in $get of provider.

if tried aim 1 of generated state didn't work when loading page 1st time or refreshing. had use "module.run(myprovider){}" force instantiation of provider make works. guess app.run running before $urlrouterprovider resolves anything.

another solution may use defer bootstrap of application removing ng-app , using angular.bootstrap when you're ready.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -