jeudi 23 mars 2017

Ember: How do I get simple form data without a model?

I'm trying to do get a single string from a form input and log it to the console. Is there a way to do this without using an Ember Data model?

Here's the form component in Handlebars:

// my-form.hbs
<form >
  
  <button class="btn btn-primary">Get Early Access</button>
</form>

And here's the current code from the component:

// my-form.js
import Ember from 'ember';

export default Ember.Component.extend({
  actions: {
    grabNewEmail() {
      let email = /* I want to get this string from the input on submit */
      console.log(email);
    }
  }
});

Is it possible to simply grab the input string, or am I required to create a model?

Thanks!




Aucun commentaire:

Enregistrer un commentaire