Fork me on GitHub

apply

This method wraps Meteor.apply method to run it's callback in a digestion cycle so angular will detect the changes and update the views accordingly.

Arguments

Param Type Details Required
name String

Name of method to invoke

Yes
params Array

Optional arguments to send to method

No
callback Function

Optional callback

No

Usage Example:

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

  this.apply('add', [1, 2], (err, result) => {
    this.result = result;
  });
}]);

The example above will invoke the meteor method add with 1 and 2 as parameters. When the result arrives arrives from the server, the callback method will run and then angular-meteor will run a digestive cycle on the scope.