I have my custome component defined as below;
{{my-component field=(my-from-section section1 "CONST1" "CONST2") targetObject=this changeDropdown=(action 'onSelectField')}}
In my corresponding component JS, I have
actions:{
onSelectField: function(field, fieldVal1){
}
}
My question is I am not sure how my component picks/gets the values (field, fieldVal1) in the action method
I do not see it being directly passed from the component reference.
Is there some other place I need to look ?
I am using Ember v1.13
In my corresponding component JS
Your component is firing actions into the controller.
As for handling actions in your component, only actions fired in the context of the components gets handled on the component. In other words, actions fired by things inside my-component.hbs
As for passing things into the action, you only do this when you’re firing actions yourself inside your component.
this.sendAction('changeDropdown', field, fieldVal1);
Just one more thing. Is it also necessary to have targetObject defined for firing/handling actions from say one component to other nested component OR from one component to some controller ?
Nope, that’s what closure actions helped to solve.
A slightly related, but good read, on component composition Reusable components