ember.js - Using same model for two different templates -


i have model , use 2 different templates on page. didn't find on how specify model use template (other name).

for example, display subusers model "subusers" in template named "assignationdd". right now, have template named "subusers" links model automatically, can reuse model in template?

edit :

i have multi-model ressource because need both conversations , subusers @ root of app. should have precised before. there no change in url or route, want display model in 2 different templates. , yes read docs on ember-data (and shows few , simpler examples).

router :

app.router.map(function(){  //routing list raw namespace path this.resource('conversations', { path : '/' }, function() {     this.resource('conversation', { path : '/:conversation_id'}); });  }); 

route :

app.conversationsroute = ember.route.extend({  subusers: null, currentuser: null,  model: function(params){          return this.store.find('conversation', { status : params.status}); },  setupcontroller: function(controller, model){      this.controller.set('content', model);      if(!this.get('subusers'))     {         this.set('subusers', this.store.findall('subuser'));     }      this.controllerfor('subusers').set('content', this.get('subusers')); },  queryparams: {     status: {         refreshmodel: true     } } }); 

if understand correctly, model assigned route , not template. can use 1 model in multiple routes. suggest read getting started section on ember , ember data.

first of all, don't nest resources. resource should noun, , route should verb. router should this:

//routing list raw namespace path this.resource('conversations', { path : '/' }, function() {     this.route('view', { path : '/:conversation_id'}); }); 

secondly, try multiple models:

model: function (params) {     return ember.rsvp.hash({         conversation: this.store.find('conversation', { status: params.status}),         subusers: this.store.findall('subuser')     }); } 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -