How to change change event on selected emberjs

The behavior I want is to change the selection in order to preserve its 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}} 

therefore, if I went with a solution for observables, then I want to also know which specific element was changed to update it.

+6
source share
1 answer

add observer and selection to the control.

 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}} 
+7
source

Source: https://habr.com/ru/post/970955/


All Articles