Ho Victor,

I assume this is a sample and not something you would do like this in 
production?
When you need functions that are attached to $scope, the easiest way is 
just inject $scope.
Below I adapted your sample to do just this.
But if you need to apply something in a controller, you probably doing 
something that can be improved upon!

function CtrlAs($scope) {

  var self = this;

  self.action = 'Click';
  self.click = function() {
    self.action = 'waiting 2 sec';
    foo(function() {
      $scope.$apply(function() {    //what about $scope.$apply here?
        self.action = 'timeout';
      });
    });
  }
}

Regards
Sander
​

-- 
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/d/optout.

Reply via email to