Keep modules running in the same order

15 views
Skip to first unread message

mark goldin

unread,
Sep 24, 2015, 5:06:17 PM9/24/15
to AngularJS

During Bootstrapping after html page has been loaded a main module is loading and running. While running it gets tokens for authentication. When main menu becomes available I can click on it, load another module, and get data that is protected by tokens. At this time browser address bar changes to: main.html/item. But if at this point I refresh it by hitting F5 I get an error because a token is not available yet. Obviously, module 2 runs before the main module. Is there a way of running modules always in the initial order?


Thanks

Sander Elias

unread,
Sep 25, 2015, 5:37:05 AM9/25/15
to AngularJS
Hi Mark,

That's not the way to solve this particular issue. There is more then one way to solve this. What is the best in your situation I can only guess. One solution is keep the tokens in localstorage. fetch them on reload of your app.

Regards
Sander

mark goldin

unread,
Sep 25, 2015, 9:11:53 AM9/25/15
to AngularJS
And fetching them at reload is the problem. When the app loads initially it gets a token. But after loading another module and refreshing the app it's not following the same loading order. The last loaded module is trying loading before the first module completes its run.

--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/gOrlOKs6FFk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages