The behavior that i want is when changing the select is to save it’s model
I though about using observable, but i have another problem
my view looks something like this
{{#each item in model.Items}}
<div class="select">
{{view Ember.Select
content=typesLookup
selection=type
prompt="Select Type"
}}
</div>
{{/each}}
so if i went with the observables solution, what i want is to also know the specific item that has changed to update it
jhsu
2
you could set the value on the select and .observes('someProperty')
from the controller:
{{view Ember.Select value=someProperty}}
or you could define an action on a select bound to change
:
<select {{action 'save' on='change'}}>
</select>
To answer my own question
I asked this question in stackoverflow and got an answer from kingpin2k saying:
add the observer and selection on an itemController.
App.FooController = Em.ObjectController.extend({
type:undefined,
watchType: function() {
console.log('this model changed', this.get('model'));
}.observes('type')
});
{{#each item in model.Items itemController='foo'}}
<div class="select">
{{view Ember.Select
content=typesLookup
selection=item.type
prompt="Select Type"
}}
</div>
{{/each}}