プロパティtoおよびfromを持つ日付ピッカー用の ArrayController があります。ユーザーが UI から新しい日付範囲を選択すると、値が変更されます。
したがって、オブザーバーが行き来する関数は、日付範囲の 1 回の変更に対して 2 回トリガーされます。
日付範囲が変わるたびに関数を1つだけトリガーしたい。残り火でそれを行う方法についての提案
app = Ember.Application.create();
app.Time = Ember.ArrayController.create({
to: null,
from: null,
rootElement: "#time",
debug1: function() {
this.set('to', 1);
this.set('from', 2);
},
debug2: function() {
this.setProperties( {
'to': 3,
'from': 4
});
},
debug3: function() {
this.beginPropertyChanges();
this.set('to', 5);
this.set('from', 6);
this.endPropertyChanges();
},
search: function() {
alert('called');
}.observes('to', 'from')
});