iron-meteor / iron-router

A client and server side router designed specifically for Meteor.
MIT License
1.98k stars 413 forks source link

subscriptions ready,but template show loading #1548

Closed lifenglsf closed 7 years ago

lifenglsf commented 8 years ago
Router.route('/group/chat/:_id',{
    action:function(){
        if (this.ready()) {
            console.log('ready');
            userId = Meteor.userId();
            if(userId){
                groupid = this.params._id;
                if(!cgroup.findOne({_id:groupid})){
                    BlazeLayout.render('mainLayout',{main:'datanotfound'});
                }else{
                    BlazeLayout.render('mainLayout',{main:'groupchat',params:{groupid:groupid}});
                }

            }else{
                Router.go('login');
            }
        } else {
            BlazeLayout.render('mainLayout',{main:'datanotfound'});
        }

    },
    waitOn:function(){
        return [Meteor.subscribe('groups'),
        Meteor.subscribe('allusers'),
        Meteor.subscribe('chatlogs',this.params._id)];
    }
})

i can get all subscribe collection data,but template content contains string "loading".How can i remove "loading" after subscriptions.I did not define loading template

ghost commented 7 years ago

You probably forgot to add "this.next()" in your action function, after your condition.