Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 过渡不起作用_Javascript_Ember.js - Fatal编程技术网

Javascript 过渡不起作用

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

我想创建一个转换,比如,如果有人转到index或/profile-details,它将被重定向到/profile-details/preview。这是我的地图和重定向代码:

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);