Javascript sendAction没有';行不通

Javascript sendAction没有';行不通,javascript,ember.js,ember-data,Javascript,Ember.js,Ember Data,我正试图在我的组件中构建一个表单,我想将操作从我的组件发送到我的路由。在我的表格中,我有4个输入和一个保存按钮: template/author.hbs {{author-profile author=model action="save"}} template/component/author-profile.hbs <form class="form-horizontal" {{action "save" on="submit"}}> {{input type="text"

我正试图在我的组件中构建一个表单,我想将操作从我的组件发送到我的路由。在我的表格中,我有4个输入和一个保存按钮:

template/author.hbs

{{author-profile author=model action="save"}}

template/component/author-profile.hbs

<form class="form-horizontal" {{action "save" on="submit"}}>
{{input type="text" value=author.firstname}}
{{input type="text" value=author.water}}

{{input type="text" value=author.birth.town}}
{{input type="date" value=author.birth.date}}

<button  type="submit" class="btn btn-default">Save</button>
</form>
为了在LocalStorage中创建记录,我需要将操作从组件发送到路由:

组件/author-profile.js

  actions: {
    save: function() {
      this.sendAction('action');
    }
  }
现在,当我收到操作时,我应该保存,但我收到以下错误:

Uncaught TypeError: Cannot read property 'get' of null
这是我的路线:

routes/author.js

actions: {
    save: function() {
        //Create New author
        var newAuthor = this.store.createRecord('author', {
            firstname: this.get('author.firstname'),
            surname: this.get('author.surname'),
            town: this.get('author.birth.town'),
            date: this.get('author.birth.date')
        });
        newAuthor.save();
    }
}

您需要将模型与操作一起发送,或者通过路径中的
this.get('currentModel')
访问它选中此链接我的帮助
routes/author.js

actions: {
    save: function() {
        //Create New author
        var newAuthor = this.store.createRecord('author', {
            firstname: this.get('author.firstname'),
            surname: this.get('author.surname'),
            town: this.get('author.birth.town'),
            date: this.get('author.birth.date')
        });
        newAuthor.save();
    }
}