I would use Meteor.user() in data iron-router, but this is undefined at start...
I'm trying with:
waitOn: function() {
return curretUserHandle;
},
data: function() {
// access to Meteor.user().username, give me undefined
[...]
var curretUserHandle = {
ready: function () {
return 'undefined' !== typeof Meteor.user();
}
};
but data function of route is always call before curretUserHandle.ready() return true
I know that i can add if(Meteor.user()) in data, but this option don't like.
Why data don't wait that Meteor.user() is ready?
Router.onBeforeAction('loading')
anywhere? Without it,waitOn
wont wait. – LumberingloadingTemplate: 'Loading'
andRouter.onBeforeAction('loading');
... The problem occur only when user go directly to the route or refresh page (F5) – Pliskereturn !!Meteor.user()
. – Matthews'undefined' !== typeof Meteor.user()
. returntrue
also if no user is logged...but the problem is thatdata
don't want wait!! :( – Pliske