mardi 10 février 2015

Properties on nested objects in ember doesn't fire if the object key was in PascalCase

This is a why this happens question


like the title suggests, if I have a PascalCase object key, custom properties on it won't fire when the model properties changes


Here is an example



App.CustomModel = Ember.Object.extend({
workProp: function() {
return this.get('work.val');
}.property('work.val'),
wontWorkProp: function() {
return this.get('WontWork.val');
}.property('WontWork.val')
});

App.IndexRoute = Ember.Route.extend({
model: function() {
return App.CustomModel.create({
work: {
val: 'Bar'
},
WontWork: {
val: 'Bar'
}
});
}
});


and the hbs



<h2>This works</h2>
<div>
{{model.workProp}}
{{model.work.val}}
{{input value=model.work.val}}
</div>
<h2>This doesn't</h2>
<div>
{{model.wontWorkProp}}
{{model.WontWork.val}}
{{input value=model.WontWork.val}}
</div>


Fiddle: http://ift.tt/1EUNhVl


Any idea why?





Aucun commentaire:

Enregistrer un commentaire