Skip to content
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

Suggestion: Unless #41

Closed
geoah opened this issue Sep 14, 2014 · 1 comment
Closed

Suggestion: Unless #41

geoah opened this issue Sep 14, 2014 · 1 comment

Comments

@geoah
Copy link

geoah commented Sep 14, 2014

I've just discovered angular busy and have fallen in love with it. I'm adding it on buttons, forms, tabs... everywhere hehe. The combination of ng-show="something.$resolved" and cg-busy="something.$promise" has made my day.

The only issue I am currently facing is when I am on a view with ng-busy that is displaying content that resulted from the same promise that is bound on ng-busy. When I try to refresh the data ng-busy sees the promise and shows up the loading sign (as it should). But since I have data showing, I'd like to allow the user to keep seeing them and show the loading somewhere else.

To do so it would require something like cg-busy-unless="something.length>0" so cg-busy doesn't get triggered if length>0. This way I could have 2 cg-busy divs, one for when there is no content (length=0) and one for when there is (length>0).

I am pretty sure there are more things that this could be used for.

ps. Thank you for your amazing work. This is my new favorite ng module! :)

@cgross
Copy link
Owner

cgross commented Sep 15, 2014

Thanks! I'm glad you like angular-busy.

You can pass any expression to the directive (the result of the expression should just be a promise, or a config object, or falsy value). So you could do something like:

<div cg-busy="something.length === 0 ? something.$promise : null"></div>

I think that should do the trick.

@geoah geoah closed this as completed Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants