I am requesting list of data in a form from the user
Example : Student Form
Name, Roll Number
Created a Model Student.js
var Student = DS.Model.extend({
Name : DS.attr('string'),
RollNo : DS.attr('number'),
});
I have a action on submit form data
add : function() {
var student = this.store.createRecord('student'{'Name':this.get('Name'),'RollNo':this.get('RollNo')});
student.save();
}
On Save, adapter (application.js)
createRecord : function(store, type, record) {
// Remove 'Student' Root element from json
// Code Required for me here - for converting that json to form data
//because in chrome network, my data is sent as Request payload.
}
URL must be POST '/api/Student/add/' with form data appended to the request
Aucun commentaire:
Enregistrer un commentaire