Meteor-Angular access to Meteor.Settings


#1

Hi Folks,

I have set up my settings.json with some public constants to be shared app wide. Now I tried to access these constants inside Angular and first place to look was at @meteor.settings. But there is nothing to be found like this. To access the settings I did a workaround writing a method that returns the public part of the settings.json:

Meteor.methods({
    settings: function () {
         return Meteor.settings.public;
    });

And on the client I am calling this method:

$meteor.call('settings').then(
    function (data) {
        $scope.constants = data.constants
    },
    function (err) {
        console.log('failed to load settings', err);
    }
);

Is there a better way to achive what I am doing here? Is it possible to publish the settings in another way? Or am I missing the spot where to look for the Meteor.settings inside Angular?

Greetings