ember.js - Cannot load associated records from a router (ember 1.0.0 and ember-data 1.0.0-beta.1) -
i have router loads "place".
app.placeroute = ember.route.extend({ model: function(params) { return this.store.find('place', params.place_id); }, setupcontroller: function(controller, model) { this._super(controller, model); //the promise way ? var placeid = model.get('id'); var myrecords = this.store.find('record', {place:placeid}).then(function(recs){ console.log("does happen ?"); //never logged this.controllerfor('records').set('content', recs); }); //or way below ? //this.controllerfor('records').set('content', myrecords); //the works (which not want displays like): //this.controllerfor('records').set('content', app.record.fixtures); this.controllerfor('places').set('content', this.store.find('place')); }, rendertemplate: function(){ this.render('place', { controller: 'place' }); this.render('display-graph-list', { into: 'place', outlet: 'graphs', controller: 'records' }); } });
this place has associated "records".
app.place = ds.model.extend({ name: attr('string') , desc: attr('string') , records: hasmany('record') , site: belongsto("site") }); app.record = ds.model.extend({ name: attr('string'), type: attr('string'), data: attr('string'), belongsto: attr('place') });
as indicated ember-data 1.0.0 transition guide, uses promises retrieve data, here, nothing happens.
here jsbin see mean: http://jsbin.com/imedoce/6/
when navigate place, should have @ least 1 record displayed.
i cannot figure out how load , display records. miss ?
is there better way display array of sub-items of model ?
this combination of 2 issues in ember-data 1.0.0-beta.1
the lack of display due hasmany/belongsto relationships: commenting these lines app.place , app.record make displayed.
however problem appears: 'data' keyword should not used.
replacing 'datapath' makes work.`
edit: problem solved ember-data 1.0.0-beta.2
Comments
Post a Comment