mardi 26 décembre 2017

Ember JS: select list with selected value

I am trying to create a select component. In which I need to select an option based on the value in object.

Found something similar here

Implemented same:

<select>
  <option value="" selected disabled >Select </option>
  
    <option value= selected=></option>
  
</select>

Here sourceType.id is id for current option and selectedOption is sourceType reference in source object. Type is number in REST service response for both of them.

When I tried to print value of eq sourceType.id selectedOption in option it is giving me false. Then I checked for eq documentation, it is a === b

  1. Why is it giving false even if value and type both are same.
  2. Is there any way to just check for value like a == b.



Aucun commentaire:

Enregistrer un commentaire