0

this.get('property_1')常に null である理由を理解できる人はいますか? どうすれば修正できますか?

App.SomeView = Em.View.extend({
    property_1: null,

    didInsertElement: function() {
        this.scheduleRefresh();
    },

    scheduleRefresh: function(){
        Ember.run.scheduleOnce('afterRender', this, this.refresh);
    }.observes('controller.filter_params'),

    refresh: function(){

        if (!this.get('property_1')) {
            this.set('property_1', 'Hello');
        }  
    }
});

ありがとう!

4

1 に答える 1

1

上記のコードは問題なく動作します。この jsfiddle を見てくださいproperty_1コントローラーからビュー プロパティを取得しようとしている可能性はありますか? その場合は、コントローラーでプロパティを定義し、ビューからバインドする必要があります。

于 2013-10-06T20:21:26.817 に答える