Sub manager with angular-meteor

Hello,

Is it possible to use Sub Manager with angular-meteor ? https://github.com/kadirahq/subs-manager

If so can somebody provide a short example ?

Thank you

I am guessing you’re using subs-manager because you want to optimize the subscriptions as per the README

Normally you invoke subscriptions inside the template level or in the router level(in the case of Iron Router). So, when you are switching routes or changing templates/components, subscriptions will run again.

Personally I actually like that the subscriptions do get removed just so my client side resources are not exhausted.

However, if you wanted to do that with Angular Meteor, I think you can just put the subscription against the $rootScope so it does not disappear. But personally I don’t think you should do that.

$rootScope.subscribe('pub')

I’m using subscache which should be basically the same: https://github.com/ccorcos/meteor-subs-cache . You can use it normally inside resolve and it will cache subscriptions on route change:

    .state('hometabs.somestate', {
      url: '/somestate',
      abstract: true,
      views: {
        'hometabs-somestate': {
          template: "<ion-nav-view></ion-nav-view>"
        }
      },
      resolve: {
        tokens: ['$q', function ($q) {
          var deferred = $q.defer();

          subsCache.subscribe('tokens', {
            onReady: deferred.resolve,
            onStop: deferred.reject
          });

          return deferred.promise;
        }]
      }
    })