Fork me on GitHub

call

This method wraps Meteor.call 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
arguments Any

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.call('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.