I have model mailbox with collectionAction
import DS from 'ember-data'
import { collectionAction } from 'ember-api-actions'
export default DS.Model.extend({
mailbox: DS.attr(), //display only
pin: DS.attr(),
download: collectionAction({ path: 'greeting'})
})
and when i try to call download from my component i get an error
import Component from '@ember/component'
import Ember from 'ember'
import FileSaverMixin from 'ember-cli-file-saver/mixins/file-saver'
export default Component.extend(FileSaverMixin, {
hifi: Ember.inject.service(),
notifications: Ember.inject.service('notification-messages'),
startPlay: true,
changeset: {},
actions: {
toggle () {
let hifi = this.get('hifi')
if (this.get('startPlay')){
this.set('startPlay', false )
this.get('changeset').get('download')().then((content) => {
this.saveFileAs(this.get('filename'), content, this.get('contentType'))
})
this.get('play')()
} else {
hifi.togglePause();
}
},
}
})
The error is Uncaught TypeError: Cannot read property 'constructor' of undefined. I check my cod/ It is the same like ember-api-actions But my cod did not work. Please help me. I don't understand what is wrong.
Aucun commentaire:
Enregistrer un commentaire