0
내 템플릿에서이 선택을 사용하면 모델이 더러워 져서 init에서 관찰자가 트리거됩니다. 이유가 무엇입니까? 변화에 대한 내 모델을 업데이트 할 수 있기를 원하지만 이제 init에서 init 함수가 실행되고 init의 모든 단일 항목에 대해 api 호출을하고 싶지 않습니다.Ember는 초기화시 더러운 모델을 선택합니다.
서식 :
{{#each booking in bookings itemController="booking"}}
{{isDirty}} // this is true
{{view "select" content=dateRange value=booking.playingOn optionValuePath="content.date" optionLabelPath="content.day"}}
{{/each}}
컨트롤러 :
나는 값 이해 같이// this is running on init and when you select something in the select drop down.
updatePlayingOn: function(){
console.log(this.get('currentState.stateName')); // logs root.loaded.updated.uncommitted
}.observes('playingOn')
= booking.playingOn가 동일한 값 playingOn 모델의 속성을 갱신하고,이 모델이 더러워 제조.
팁 주셔서 감사합니다! DS.attr ('number')을 사용하여 백업 모델을 선택하는 문제가 발생했습니다. 문자열로 변경하면 해결됩니다. –