是否可以通过屏幕的JS代码导航到不同的屏幕?

时间:2015-02-20 10:09:05

标签: javascript visual-studio visual-studio-lightswitch

这基本上就是我想做的事情:

myapp.StartScreen.created = function (screen) {
    screen.getIsAdmin().then(function success() {
        this.navigate("AdminHome.lsml");
    }, function error() {
        this.navigate("UserHome.lsml");
    });
};

但使用“this.navigate”或“this.location”导航似乎不起作用。有什么建议吗?

1 个答案:

答案 0 :(得分:0)

看起来以下内容对我有用:

myapp.StartScreen.created = function (screen) {
    screen.getIsAdmin().then(function success() {
        this.window.location.href = '#/AdminHome/undefined/[dee7135da]';
    }, function error() {
        this.window.location.href = '#/ClientHome/undefined/[c4fb70ef3]';        
    });
};