javascript - Ember.js - Rendering additional data for a model -


i have app model , apps have id , name.

  this.resource("apps", function() {     this.route('show', { path: ':app_id' });   }); 

i'd make show view show metrics app, query pretty intense, don't want include in call index view (let's table).

i'm not sure if possible ember-data because app in store simplified payload , not re-requested show view metrics.

then head went making metrics different model accessible apps/1/metrics , making model , everything.

but if sideload data, have provide id references metrics particular app. , it's hasone there's not ids there database backed model.

what's best way load in additional data model or expand information supplied in show view?

the backend rails , ember-cli project.

the easiest way retrieve data in route's aftermodel handler:

var showroute = ember.route.extend({   model: function(params) {     // load model , return it.     // fire if model isn't passed.   },   aftermodel: function(model, transition) {     // load rest of data based on model , return it.     // fires every time route re-loads (wether passed in or via model method).   } }); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -