Open cboden opened 10 years ago
Aren't your ajax calls returning promises? It would seem harder to assign booleans since you'd have to add a then() and set a flag...?
"yes" to both of your questions. I am using a boolean already for other triggers. In addition I do a lot of calculation after my data comes back so I want the cg-busy to stay up longer. I'm currently achieving this by creating a second promise.
Vote +1 :) That would be really helpful to have this option to just pass a boolean
I think the benefit of this plugin is in it's simplicity and not needing any flags like @cgross mentioned above. If you want to go the boolean route, why not just use an animated loading icon with ng-show?
+1, even more than 1... +5!! i would like to have ability to use both promise and boolean.
+1 for boolean. I have multiple promises active in sub-directives, but I track them in central place using http interceptor, where I have a count of active requests. If that count is > 0, one busy covering the whole main directive should be shown. Only when all of them finish loading the busy directive should disappear.
Done in https://github.com/myflowpl/angular-busy2/commit/ab9845ba1a2592f2f05ca3d613f983db9f421675 angular-busy2@4.1.6 node_modules/angular-busy2
Since promise wrapping has been deprecated in Angular 1.2 it makes less sense to bind promises to the template scope. I would find it easier just to pass a boolean value to
cg-busy
.