jeudi 9 juillet 2015

Use select element to control ember views

I have a select form element with 3 options, and then a next button. When the next button is clicked it should look at the users selection and show a new form.

This current code is not giving me the desired results

hbr

<div>
<label>Pick a form?</label>
{{view "select" content=myForms}}
</div>

<div>
    <a {{action 'showForm'}}role="button">Next</a>
</div>
</form>

{{if holdingsValue === '1'}}
  <form>see form 1 </form>

{{if holdingsValue === '2'}}
  <form>see form 2</form>

{{if holdingsValue === '3'}}
  <form>see form 3</form>

ember.js

myForms: ['1', '2', '3'],
actions: {
    showForm: function() {
        var holdingsValue = this.get('myForms.val()', [])
        console.log(this.get(holdingsValue));
    }
}

Aucun commentaire:

Enregistrer un commentaire