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.
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 |
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 thenangular-meteor
will run a digestive cycle on the scope.