Ember.js 在objectcontroller上取消设置属性

Ember.js 在objectcontroller上取消设置属性,ember.js,Ember.js,我有以下路由器: Router.map(function() { this.resource('cart', function() { // order routes this.route('shipping'); this.route('checkout'); this.route('payment'); this.route('thanks'); }); }); 当我在感谢路线时,我想在结帐

我有以下路由器:

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',“”)

但我得到了这个错误:
未捕获错误:属性集失败:路径“controllers.cart.checkout”中的对象找不到或已被销毁。


这意味着什么

你很幸运,因为从1.7.0版开始,余烬在路线上有着绝对美妙的钩子。这正是针对这种情况

App.CartCheckoutRoute = Ember.Route.extend({
    resetController: function(controller, isExiting, transition) {
        controller.set('commentCustomer', '');
    }
});

试试这个
this.set('controllers.cartCheckout.commentCustomer',”)
@CodeJack谢谢你的评论!不过GJK给出了答案。谢谢GJK,很好的发现!它就像一个符咒。我想我还没有仔细阅读上次的变更日志。。