-
Notifications
You must be signed in to change notification settings - Fork 3k
$state.loaded #23
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
Comments
There is currently a $state.transition property, which is a promise for the next state, i.e. it is resolved when the state transition completes (or rejected if it fails). $state.transition is never null. The way things are currently implemented, views only update once all dependencies are resolved. This is because the view directive needs to create the controller at the time the view is created, and the controller needs the dependencies. I was thinking of having a $state.next property which is non-null only if there is currently a transition in progress, so that you could use that to display a loading indicator (this would probably be done in a global place outside any ng-view) with something like ``ng-show="$state.next"` |
I'm not sure that $state.next says Boolean to me. I would assume it would be a state object of the next state being loaded. I think we need a loaded property; I hate to play this card, but ember's routes have them and they use them quite a bit in examples. I just think people are going to be looking for it. I think it's so common that we need a nice obvious solution for it. |
yeah next wouldn't be a boolean, but you could use it as one -- it would be non-null if transition is in progress. We could call it 'loading' rather than next? That would also let you do something along the lines of I think providing access to the state that's being loaded can be very useful compared to just a boolean. |
Hey I like that! I just think people will be looking for a loading Man, its just that it may not be as clear as just having two separate On Sat, Feb 16, 2013 at 10:53 PM, Karsten Sperling <notifications@github.com
Thanks, Tim Kindberg |
I guess we can put 'loaded' down on the nice-to-have conveniences list... I'd just like to get the essential APIs and then see how many of the things we now predict will be very convenient really are. If I saw both 'loaded' and 'loading' in the API docs I'd wonder if their semantics differ in some subtle way or why else somebody would add a property that's only saving a single negation. I've previously worked with the rule that in order to be "allowed" to add a utility / convenience method or property on top of an existing API, you have to have done it the pedestrian way at least three times first. I think we should follow a similar approach and get some real world use of the bare-bones API and then see where the convenience APIs would really be useful in practice. |
That's fair. |
This issue has been automatically marked as stale because it has not had This does not mean that the issue is invalid. Valid issues Thank you for your contributions. |
I think the loading indicator could just be a
loaded
property that is true once all views and dependencies have been loaded and resolved. The you can use the property in you templates to show some indicator if loaded while false. I think this should be a separate feature request because its SO common.Also, Maybe a directive to automatically display a "loading.html" partial or have it be a setting on each state?
The text was updated successfully, but these errors were encountered: