Wait for subscription before launching angular app

Hi,

  • I am using angular-meteor with pascalprecht.translate
  • the translations object have to be stored in the database in order that some users can modify the translations via a back-office
  • I subscribe the collection containing the translations and loads them in un the .config()
  • it works well BUT when loading the application the page is rendered before the subscription is ready.an during a short period of time the texts are not translated.
  • I have to do something in order that we always see translations even during the begining

My question is the following:
Is it possible to make angular wait for the subscription to be ready before it is launched ?

Best regards

bboisvert

angular.module(‘test’).config([’$translateProvider’, function ($translateProvider) {

Meteor.subscribe(‘settings’, function(){
test = Settings.findOne({name: “translations”});
$translateProvider.translations(‘fr-FR’, test[‘fr-FR’]);
$translateProvider.translations(‘en-EN’, test[‘en-EN’]);
});

}]);

Hi,

I had a solution on stackoverflow:

Best regards,

bboisvert