0
votes

I am using Meteor and Angular, and am having a hard time making my admin-specific code function properly. Locally, it works great, but once I use meteor build and put it up on the server, my code doesn't function, but I don't see any errors either. Specifically, inside my /imports/components/storyAdmin.js file, I have the following method:

this.isAdministrator =  Meteor.call('users.isAdmin', Meteor.userId(), function(error, result) {
    if (result) {
        _that.isAdministrator = result;
        _that.scope.$digest();
    }
});

The problem is, it doesn't seem to run, and I can't really debug on the server since the code is all minified and uglified (I think that's the word).

Am I going about this the wrong way? I Googled a lot about this and haven't found a good way to do it yet, or how to fix the issue I'm having.

When are you doing your Meteor.call ? Isn't this.isAdministrator always undefined ?user3636214
The Meteor.call is happening in the constructor of my StoryAdminController, so I'm guessing just on page load.Nicholaus Chipping
Could you try to place the meteor.call inside a tracker.autorun and also log the error when there is an error ?user3636214
How can I log the error? This is only happening once I put it up on my server (not locally) and I'm not getting an error on the server. I'm guessing I should just put the Tracker.autorun around my above code, and put it up on the server and see what happens, or am I misunderstanding?Nicholaus Chipping
You have a error variable in your callback. Just do if(error)console.error(error); Yes put the code in a tracker.autorun.user3636214