Fork me on GitHub


This method is a wrapper of Tracker.autorun and shares exactly the same API.

The argument of this method is a callback, which will be called each time Autorun will be used.

The autorun method is part of the ReactiveContext, and available on every context and $scope and will stop automatically when when it's context ($scope) is destroyed.


Name Type Details Required
runFunc Function The function to run. It receives one argument: the Computation object that will be returned. Yes

Example with getReactively:

myModule.controller('MyCtrl', ['$scope', '$reactive', function($scope, $reactive) {

  this.myVar = 10;

  this.autorun(() => {
    console.log('Autorun!!', this.getReactively('myVar'));

  this.myVar = 50; // This will cause the autorun function method to run again