我有以下路由器:
Router.map(function() {
this.resource('cart', function() {
// order routes
this.route('shipping');
this.route('checkout');
this.route('payment');
this.route('thanks');
});
});
在感谢路线上,我想在结帐时取消设置自定义注释属性。这是因为下一次客户访问结帐路线会再次显示该注释。
因此,我要执行以下操作: this.set('controllers.cart.checkout.commentCustomer', "");
但是我得到这个错误: Uncaught Error: Property set failed: object in path "controllers.cart.checkout" could not be found or was destroyed.
那是什么意思
真幸运,因为自1.7.0起,Ember在路由中具有绝对出色的resetController挂钩。正是针对这种情况。
App.CartCheckoutRoute = Ember.Route.extend({
resetController: function(controller, isExiting, transition) {
controller.set('commentCustomer', '');
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句