cgross / angular-busy

Show busy/loading indicators on any element during $http requests (or any promise).
http://cgross.github.io/angular-busy/demo
MIT License
1.44k stars 257 forks source link

Gain access to $cgBusyIsActive() #118

Open davfive opened 5 years ago

davfive commented 5 years ago

I'm using minDuration because the action is quick but I'm "Checking for updates ..." and I want to leave it up long enough for them to read.

<div cg-busy="$ctrl.updatesBusy">
  <div ng-show="$ctrl.updateResult.done">
    ...
   </div>
</div>

However, the content in the second div will show behind the cgBusy while it's finishing up because my promise completed but cg-busy is still displaying. I want my div to show after cgBusy goes away.

In looking at the code, there is a call which is used in the directive for it's ng-show, that would be perfect for me: $cgBusyIsActive(). Then I could do

<div ng-show="!$cgBusyIsActive() && $ctrl.updateResult.done">

It is created, however, in a child scope, so I don't have access to it. It would be great to be able to have this feature.