ember.js - Ember data createRecord creates multiple records -
when inspect data in ember inspector see multiple record 1 id(int) , 1 without id(null).
using ember 2.9.1
save: function(){ var title = this.get('title'); this.store.createrecord('post',{ title:title }).save(); this.setproperties({ title:''}); this.transitiontoroute('posts'); }
node backend
router.post('/', function(req, res, next) { post.create({ title: req.body.data.attributes.title }).then(function () { res.set('content-type','application/vnd.api+json'); return res.send({ "msg": "post created successfully", data:null }); }); });
return res.status(201).send({ data:{ type:'post', attributes:{ id:post.id, name:post.title } } });
the following code works properly.this known issue in ember data.
Comments
Post a Comment