ember.js - Iterating over records of a model without knowing the model -
hi try create gui (ember-data) models used in application.
thats router:
app.router.map(function () { this.resource('config', function() { this.resource('configmodel', {path: ':configmodel'}); });
in config want list defined models. by:
app.configroute = ember.route.extend({ setupcontroller: function(controller) { var model = []; for(var property in app) { if(app[property] && app[property].superclass && app[property].superclass === ds.model) { model.push({name: property, model: app[property].find()}); } } controller.set('content', model); } });
the config template looks this:
<div> <ul> {{#each controller}} <li>{{#linkto configmodel model}}{{name}}{{/linkto}}</li> {{/each}} </ul> </div> <div> {{outlet}} </div>
up here works , list of models, link me configmodel route. in configmodel route want show list of records, don't know how iterate on them. if model list of user records {{#each user in controller}}, don't know model i'm working with, still want list of records.
Comments
Post a Comment