mardi 24 novembre 2015

Ember.JS value binding not working in Action

I am trying to get value binding working properly in my Ember app. The binding works on the input, as in, when I type text into the input field it displays next to "Your Goal:". However, when I click "Next Step", it is not displaying the value properly.

Here is a JSBIN with my issue: http://ift.tt/1MOVM41

Goal Route

import Ember from 'ember';

export default Ember.Route.extend({
  goal: '',
  actions: {
    nextStep: function() {
      console.log('Goto next step: ', this.get('goal'));
    }
  }
});

Template

<section>
  <div class="pod__content">
    Your Goal: {{goal}}
    {{input type="text" value=goal}}
  </div>
  <footer>
    <button {{action 'nextStep'}} class="btn btn--red">Next Step</button>
  </footer>
</section>




Aucun commentaire:

Enregistrer un commentaire