This API is deprecated since version 1.3.0 and no longer available since version 1.3.1

$meteor.call

A service service which wraps up Meteor.methods with AngularJS promises.


$meteor.call has been deprecated in favor of of using regular Meteor Methods directly without any wrappers.

Just call Meteor.call directly and work with the callback instead of the promise. Working with callback gives you the ability to close the subscription before it’s prepared, which you can’t do right now with the current Promise API.

Here is an example for how to migrate:

Old code:

$meteor.call('invite', $scope.party._id, user._id).then(
  function(data){
    console.log('success inviting', data);
  },
  function(err){
    console.log('failed', err);
  }
);

New code:

Meteor.call('invite', $scope.party._id, user._id, function(error, result){
  if (error) {
    console.log('failed', err);
  } else {
    console.log('success inviting', data);
  }
});

Usage

$meteor.call(name, methodArguments)

Arguments

Param Type Details Required
name string

Name of method to invoke

Yes
methodArguments any

Optional method arguments

No

Returns

promise

The promise solves successfully with the return value of the method or return reject with the error from the method


Example

$scope.invite = function(party, user){

  $meteor.call('invite', party._id, user._id).then(
    function(data){

      // Handle success
      console.log('success inviting', data.userId);
    },
    function(err){
      // Handle error
      console.log('failed', err);
    }
  );

};