- Create
collections/policies&models/policies. Look for previously created collections and models for example. - Create appropriate relationship for
models/company
initialize: function() {
this.buildRelation('policies', require('collections/policies'));
}- Create
views/collection.models/policy,views/app/collections/policies,views/app/layouts/ policies. Also create appropriate templates for these views. Look for previously created views and templates for example. - Create
routes/approute
'policies': 'policies'- Create
controllers/appmethod
policies: function() {
this.layout.getRegion('main').show(new PoliciesView({model: new Company({id: this.appUser.get('company_id'})}));- Fetch all neccessary data in
loadmethod ofviews/app/layouts/policies
load: function() {
return Promise.all([this.model.policies.fetch()]);
}- After loading data current layout view will be shown in its region. Don't forget to show fetched collection of
policiesinonBeforeAttachMethod
onBeforeAttach: function() {
this.showChildView('policies', new PoliciesView({collection: this.model.policies}));
}That's it!