Passing data to component inside component



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 ='deal');
    var dealTypes ='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?


If it’s recommending to use controller to augment models, then the course is massively outdated, I’d recommend you select more recent material.


It might be that he’s going to get to ditching controllers later? Forgot which one now, but pretty sure worked to a point through one of the books where the author say something in the line of "we use controllers now, but we’ll get rid of them later" Dunno…hooked on emberscreencast for now…hahaha, all over the place.