javascript - giving an input a dynamic value emeberjs -


so have each loop iterates on ember model:

{{#each model.product.variants |variant|}}     {{input type="radio" value=variant.id name="product_id" action="radiochecked" on="focus-in"}} {{/each}} 

what im trying set value of each input id of variant, part right here value=variant.id. seems works because example of html being rendered:

<input id="ember821" name="product_id" type="radio" value="34"> 

i removed ember classes above input make fit in 1 line.

now i'm trying when form submitted grab value of radio button checked. did give radio button action, action="radiochecked" on="focus-in" , try set product property on controller. here controller:

export default ember.controller.extend({     selectedproduct: null,      actions:{         radiochecked: function(){             console.log('action worked');             this.set('selectedproduct', value);         }     }  }); 

i error value undefined. how should go this?

value passed in, need define in function definition.

function(value){      console.log('action worked');      // note id, may want query collection      // , use object instead of id...      this.set('selectedproduct', value);   } 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -