hello,
i have created the model, route, controller, component and template … everything is working. only that file / image thing isn’t working.
i have search for tutorials but didn’t find any. the documentation of ember-file-upload and of dropzonejs helps me not.
what I need is a very simple example what is working, to understand how it is working.
any links / tutorials / examples ???
that is my controller:
import Controller from ‘@ember/controller’;
import { inject as service } from ‘@ember/service’;
import ProjectImageValidations from ‘…/…/…/validations/project-image’;
export default Controller.extend({ store: service(),
ProjectImageValidations,
actions: { save(changeset) { let { project } = this; let image = this.store.createRecord(‘project-image’, changeset.get(‘change’)); image.set(‘project’, project);
return image.save()
.then(() => {
this.transitionToRoute('project.image.index', project.id, image.id );
})
.catch((error) => {
alert(`Project-LFZ Foto couldn't be saved: ${error}`);
image.destroy();
});
}
} });