Ember.js Emberjs-发送PUT请求时模型不更改布尔值

Ember.js Emberjs-发送PUT请求时模型不更改布尔值,ember.js,Ember.js,早上好 在模型上发送更改的boolen值时,我们遇到了请求问题 当从服务器加载模型时,模型中的值为false,但是当将布尔值更新为true时,请求不会发送true,而是发送false 路由器: actions: { save:function() { let post = this.controller.get("model"); console.log(post.get("isPost")); // logs **true** post.save()

早上好

在模型上发送更改的boolen值时,我们遇到了请求问题

当从服务器加载模型时,模型中的值为false,但是当将布尔值更新为true时,请求不会发送true,而是发送false

路由器:

actions: {
    save:function() {
      let post = this.controller.get("model");
      console.log(post.get("isPost")); // logs **true**
      post.save().then(() => { // request {"description":"The Post","isPost":**false**}
          this.transitionTo('posts');
      }).catch((error) => {
        console.log(error);
      });
    }
}
型号:

import Model from './default';
import DS from 'ember-data';

export default Model.extend({
  description: DS.attr('string'),
  isPost: DS.attr('boolean')
});
我试图在模型上将布尔值设置为true direct,但它发送了相同的错误请求,发送false而不是true

airline.set('isPost',true);
airline.save…

要为属性设置默认值,请使用以下命令:

isPost: DS.attr('boolean', {defaultValue: false})

为什么要使用
import Model from./default'
而不是
DS.Model
?作为对保存的响应,您的后端返回了什么?