mardi 14 avril 2015

Bending Ember Data Records in Input Select

With this data structure:



App.Publisher = DS.Model.extend({
name: DS.attr('string'),
books: DS.hasMany('book', {async: true})
});

App.Book = DS.Model.extend({
title: DS.attr('string'),
summary: DS.attr('string'),
author: DS.belongsTo('author', {async: true}),
publisher: DS.belongsTo('publisher', {async: true})
};


In the book edit and book new forms, I'd like to display the publishers using a <input type=select>element.


My questions:


1 : how do I bind the ember-data publishers records to the input element.


2: how do I select the current book publisher in the element for edit or a default for a new book


3: how do I bind the selected publisher to the book, when submitting the form


Thanks a lot.





Aucun commentaire:

Enregistrer un commentaire