Binding action in Ember.Select

I was wondering how to link the action in Ember.Select - when the user changed the category, I could perform other operations:

{{view Ember.Select class="form-control" id="PackCategory" content=Categories optionValuePath="content.categoryId" optionLabelPath="content.name" value=VendingAdminController.selectedPack.categoryId}} 

as well as how to indicate performance as a goal?

thanks

+6
source share
2 answers

As the king suggested

Just create a function in the controller that respects the value property {{select}}

 onSelectedPackChange:function(){ //insert the code that needs to be excuted on change here }.observes('selectedPack.categoryId') 

The above code should be placed in the VendingAdminController .

+9
source

I don't have enough comments to comment on the previous answer, but I think ember syntax is not observed

onSelectedPackChange:function(){ //insert the code that needs to be excuted on change here }.observes('selectedPack.categoryId')

+5
source

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


All Articles