Javascript 过渡不起作用
我想创建一个转换,比如,如果有人转到index或/profile-details,它将被重定向到/profile-details/preview。这是我的地图和重定向代码:Javascript 过渡不起作用,javascript,ember.js,Javascript,Ember.js,我想创建一个转换,比如,如果有人转到index或/profile-details,它将被重定向到/profile-details/preview。这是我的地图和重定向代码: UserProfileApp.Router.map(function () { this.resource('profile', { path: '/' }, function () { this.resource("personal", { pat
UserProfileApp.Router.map(function () {
this.resource('profile', { path: '/' }, function () {
this.resource("personal", { path: "personal-details" }, function () {
this.route("preview", { path: "preview" });
this.route("edit", { path: "edit" });
});
this.route("loyalty", { path: "loyalty-membership" });
this.resource("passengers", { path: "passengers" }, function () {
this.route("new", { path: "new" });
this.route("passenger", { path: ":passenger_id" });
});
this.route("password", { path: "password" });
});
});
UserProfileApp.ProfileRoute = Ember.Route.extend({
beforeModel: function () {
this.transitionTo('personal');
}
});
UserProfileApp.PersonalRoute = Ember.Route.extend({
beforeModel: function () {
this.transitionTo('personal.preview');
}
});
如果我删除任何一个Transition,它都会相应地工作,但是两个Transition的in都不工作您尝试过这个吗
UserProfileApp.ProfileRoute = Ember.Route.extend({
beforeModel: function () {
this.transitionTo('personal');
}
});
UserProfileApp.PersonalRoute = Ember.Route.extend({
beforeModel: function () {
this.transitionTo('preview');
}
});
祝您好运在@Edu的附录中:
您还可以传入要转换到的id:
this.transitionTo('personal', eventualId);