@niconel wrote:
Hi,
Said this a few times now, but a total ember n00b. Learning on the go...
Been watching a course on FrontEnd Masters and when they got to ember data, it's sounds like the idea is that if you want to add something extra to your model, you use a controller. Bit confused because elsewhere I read controllers will fall away.
I needed to add something to my model and by trial and error figured out this, not sure if a good way but works fine?
Model: import Model from 'ember-data/model'; import attr from 'ember-data/attr';
export default Model.extend({ name: attr('string'), dealTypes: attr() });
Route: import Ember from 'ember';
export default Ember.Route.extend({ model: function () { var model = this.store.createRecord('deal'); var dealTypes = this.store.findAll('dealtype'); model.dealTypes = dealTypes; return model; }, .....
I then use that dealtypes in a component I created (bootstrap / select2) and all seems fine?
I guess my question is....should I bother watching the course on front-end masters further or rather stick to an up to date book like ember 101 / Rock and Roll with EmberJs?
Posts: 1
Participants: 1