Bindings on ObjectController - Ember.js

后端 未结 2 765
遇见更好的自我
遇见更好的自我 2021-02-19 12:56

When you try adding a binding to an ObjectController it doesn\'t work.

App.FailController = Em.ObjectController.extend({
    content: null,
    myBi         


        
2条回答
  •  长发绾君心
    2021-02-19 13:25

    Alternative solution:

    App.FailController = Em.ObjectController.extend({
        content: Ember.Object.create(),
        my: function() {
          return App.router.myController;
        }.property('App.router.myController')
    });
    

    or better:

    App.FailController = Em.ObjectController.extend({
        content: Ember.Object.create(),
        my: Ember.computed.alias('App.router.myController')
    });
    

提交回复
热议问题