현재 Ember.js의 개체 모델로 작업하고 있습니다. 나는 그것을 정말로 좋아하지만, 혼란스럽게하는 것이있다.Ember.js 컨트롤러 내에서 개체 확장하기
이 작동 (http://emberjs.jsbin.com/jepazo/1/edit?html,css,js,console,output) :
App.Car = Ember.Object.extend({
color: 'red',
brand: "Tesla",
desciption: function(){
return this.get('color') + this.get('brand');
}.property('color','brand')
})
App.IndexController = Ember.Controller.extend({
zl: [App.Car.create(), App.Car.create({brand: 'BMW'})]
})
하지만 컨트롤러 (http://emberjs.jsbin.com/jepazo/2/edit?html,css,js,console,output)에 선언 할 수 없습니다 : 이런 이유
App.IndexController = Ember.Controller.extend({
car: Ember.Object.extend({
color: 'red',
brand: "Tesla",
desciption: function(){
return this.get('color') + this.get('brand');
}.property('color','brand')
}),
zl: [this.get('car').create(), this.get('car').create({brand: 'BMW'})]
)};
사람이 알고 있나요
?
, 당신의 바이올린의 코드가 누락을 앞에'}); '. – givanse