Hi Sander. For your solution, I wonder how/if other components using
working.aml() during render know to update their display when the working
state changes? It seems to do this you still need to broadcast an event,
copying the busy status to a $scope variable.
On Tuesday, May 28, 2013 7:33:24 PM UTC-7, Sander Elias wrote:
>
> Hi Jonah,
>
> I would go for the service, you can use it wherever you would. Inject it
> into your directive, and into the controllers where you need it.
> the service would look something like:
> .factory("working", [function () {
> var busy = false;
> return {
> amI: function () {return busy; },
> go: function () { busy = true; },
> done: function () { busy = false; }
> };
> }])
> in your directive you can do:
> working.go();
> function redrawHack() {
> timeIntensiveFunction();
> working.done();
> }
> $timeout(redrawHack, 10);
>
> and in your template something like:
> <div ng-show="working.amI()">busy</div>
> <div my-great-ui ng-hide="working.amI()>......</div>
>
> if you have more then one thing that might be busy, and need more then one
> hold state, simply expand the service to accept a form of an ID.
>
> Regards
> Sander Elias
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.