Ember.js wizard control

后端 未结 1 1106
既然无缘
既然无缘 2021-01-14 09:51

I have an ember.js wizard control with a number of steps.

An ember model object has its various properties set at each stage of the wizard.

The only way I ca

相关标签:
1条回答
  • 2021-01-14 10:38

    You don't have to use the model_id in your path. You just need to override the model property in the routes. A basic one would be:

    @resource "steps", ->
      @route "one", {path: 'one'}
      @route "two", {path: 'two'}
    
    
    Redbot.StepsRoute = Ember.Route.extend({
      model: function() {
        return App.User.createRecord({});
      }
    });
    
    Redbot.StepsOneRoute = Ember.Route.extend({
      model: function() {
        return this.modelFor('steps');
      }
    });
    
    Redbot.StepsTwoRoute = Ember.Route.extend({
      model: function() {
        return this.modelFor('steps');
      }
    });
    

    Each child route just uses the model defined in the parent route.

    What ember does by default is just set the model using the model_id parameter, so overriding model gives you control over that functionality.

    0 讨论(0)
提交回复
热议问题