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?
Adding https://atmospherejs.com/meteorhacks/fast-render 'magically' solves this.
However, please read the note on necessary security measures: https://meteorhacks.com/fast-render/security-measures/
Only as workaround can be used:
if(this.ready())
in data
function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.