0
我有一个路由器地图下面的代码:困惑流星this.next()错误onBeforeAction
this.route('confirmTag', {
path: '/confirm-tag',
template: 'confirmTag',
controller: 'SignUpController',
onBeforeAction: function() {
if (Meteor.user()) {
if (typeof user.profile.tag === 'undefined') {
Router.go('confirm');
} else {
Router.go('checkEmail');
}
this.next();
} else {
Router.go('signUp');
}
this.next();
}
});
不过,我不断收到此错误控制台:
Exception in callback of async function:
[email protected]://localhost:3000/lib/router.js?783dc96a24a92cfd09fbf0ca371d762661a830bb:87:9
87号线在示例代码是:
if (typeof user.profile.tag === 'undefined') {
“this.next();”应该怎么做?置于上面的代码中?
在此先感谢。
我无法想象调用'this.next()'是个好主意。 –
当使用onBeforeAction – mayvn
时,this.next()实际上是需要的,但是在你的'if'的真正分支中,你要调用它两次。但也许这毕竟不是问题。 –