Is $meteor deprecated? how to return promises on subscriptions?


I’m trying to figure out how to resolve states in uiRouter in angular.

Right now I want to resolve the state when a collection from mongo is in scope.

What I’ve done is the following:

resolve: {
  organization: function ($meteor) {
    return $meteor.subscribe('currentOrganization').then(function () {
      return Organizations.findOne();

But from what I’ve read is that $meteor is deprecated.

but if I use Meteor.subscribe the state never resolves.

Is it safe to use $meteor.subscribe?


It’s still safe, but it’s deprecated.
Reason is that by default meteor doesn’t return a promise, and angular-meteor wants to be in line with “normal” meteor.

You can easily transform the callback into a promise yourself, or write a little helper function to reduce boilerplate.