Ember.js routing: how do you set a default route to render immediately?

后端 未结 3 548
日久生厌
日久生厌 2021-02-09 04:07

I\'m sure this will become clear as I dig in deeper, but for now it\'s not obvious how to make this happen.

I was following the info on this helpful SO article about ro

3条回答
  •  遇见更好的自我
    2021-02-09 04:49

    It seems this is done diffently now. I had success with this way of doing it:

    App = Ember.Application.create();
    
    App.Router.map(function() {
      // 'index' route is default
      this.resource('dashboard');
    });
    
    App.IndexRoute = Ember.Route.extend({
        redirect: function() {
            // this redirects / to /dashboard
            this.transitionTo('dashboard');
        }
    });
    
    App.DashboardRoute = Ember.Route.extend({
    });
    

提交回复
热议问题