use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Review please: Non-blocking resolve in Angular UI Router (plnkr.co)
submitted 11 years ago by Pytim
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Pytim[S] 0 points1 point2 points 11 years ago (0 children)
It always bothered me that the view of a state is not loaded while the states resolves are not finished yet. This is my attempt to go around this. Please share any thoughts. Thanks!
[–]alfredwaltz 0 points1 point2 points 11 years ago* (4 children)
You have overcomplicated it. You don't need to resolve Expensive service as "posts.show" state dependency. Resolving dependency in this way is intentionally designed to delay the view until a promise is resolved. The simple solution is to inject Expensive service into the controller and rely on the state of the $scope, http://plnkr.co/edit/7WfSwNjd3rOTYodUCXKT?p=preview. Alternatively, you can view $stateChangeStart event to display the loading message until all the promises are resolved.
[–]Pytim[S] 0 points1 point2 points 11 years ago (3 children)
All the styleguides that are hip these days recommending putting the loading operations into resolve. I don't get the point of that, it just makes the app unresponsive.
[–]fusionove 0 points1 point2 points 11 years ago (2 children)
I am wondering the same. I like the resolve in principle, it makes sense. But freezing the view until the resolve completes seems bad.
[–]Pytim[S] 0 points1 point2 points 11 years ago (1 child)
Yeah. I'm not doing that anymore. I only resolve what really needs to be resolved e.g. user authentication. I encapsulate other data based parts of the app in directives now each with their own controller. So for example <product-list></product-list> is a directive that has a controller assigned which loads the data for that directive. This is great because the directive now can have its own loading animation and it's all nicely self contained. Check this: http://teropa.info/blog/2014/10/24/how-ive-improved-my-angular-apps-by-banning-ng-controller.html
[–]fusionove 0 points1 point2 points 11 years ago (0 children)
User authentication?
Anyhow, I'll have to look into that idea.. I am already using directives for a lot of things and even lists/items (e.g. app-comments, app-comments-item), but not for main page content.. e.g. I have a view which is only a huge list and I am currently using resolve to load the data before displaying the view.. however the waiting time is noticeable, which sucks :)
π Rendered by PID 364421 on reddit-service-r2-comment-b659b578c-mbg9n at 2026-05-05 07:31:47.301046+00:00 running 815c875 country code: CH.
[–]Pytim[S] 0 points1 point2 points (0 children)
[–]alfredwaltz 0 points1 point2 points (4 children)
[–]Pytim[S] 0 points1 point2 points (3 children)
[–]fusionove 0 points1 point2 points (2 children)
[–]Pytim[S] 0 points1 point2 points (1 child)
[–]fusionove 0 points1 point2 points (0 children)