javascript - Templates on dynamic segments -


i have requirement make dynamic form (wizard) has multiple steps. want able add new steps wizard in future (or remove them) don;t create separate routes each step so:

this.resource('wizard', { path: '/' }, function() {   this.route('step1', { path: '/' });   this.route('step2');   this.route('step3');   this.route('step4');   this.route('step5'); }); 

i prefer have dynamic segment takes in name of step , loads corresponding template of same name, so

this.resource('wizard', { path: '/' }, function() {   this.route('step', { path: '/:step' }); }); 

is @ possible or wishful thinking.

i have come solution not sure considered best...

i have defined route in router take in dynamic segment name of template:

this.resource('wizard', { path: '/wizard' }, function() {   this.route('missing', { path: '/:step' }); }); 

i have created missing route takes dynamic segment model , uses load in template appropriate outlet

export default ember.route.extend({   rendertemplate: function(controller, model) {     this.render('wizard/' + model.step, {       controller: controller     });   } }); 

i love hear thoughts on solution.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -