dimanche 22 novembre 2015

Accessing properties of input helpers on form

i'm trying to create a new book in my database, but my layout is very different, i don't have a button submit in my form, he is outside, like:

<form>
 <label>Name</label>
 {{input value=book.name}}
</form>

<button>Create</button>

So.. i'm trying like this:

I'm returning a object in my routes/books/new.js:

export default Ember.Route.extend(AuthenticatedRouteMixin, {
  model () {
    return {
      name: 'test',
    };
  },

  setupController (controller, model) {
    controller.set('book', model);
  }
});

And in my button i have the action save. So, when someone clicks, in my controller/books.js i have:

actions: {
 save () {
   console.log(this.get('book');
 }
}

And this is returning undefined.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire