0

我想在一个应用程序中创建多个应用程序,这些应用程序将托管在同一台服务器上。

我使用以下链接作为指南,但我不确定如何实现其中的一些: Muliple spas

我的应用程序设置如下:

src/
    bower_components
    apps/
        app1/
            app.js
            index.html
        app2/
            app.js
            index.html

每个索引页面都有自己的 ng-app。我正在使用 grunt-contrib-connect 为应用程序提供开发服务。我有一个中间件设置默认为 app1:

middleware: function (connect, options, middlewares) {
                var modRewrite = require('connect-modrewrite');
                middlewares.unshift(modRewrite(['!\\.html|\\.js|\\.ts|\\.ttf|\\.woff|\\.eot|\\.svg|\\.css|\\.png$ /apps/app1/index.html [L]'])); 
                return middlewares;
            }

当我运行应用程序时 app1 按预期工作,但我不确定如何导航到 app2 并让它引导。

如果我将中间件更改为默认为 app2,它也可以按预期工作,因此两个应用程序都可以自行运行。

我怎样才能移动到 app2 并让它引导?我是否需要在 grunt-contrib-connect 中以某种方式映射它?

我尝试使用 href 和 $window.location.href 简单地导航到 app2 但无济于事。

4

0 回答 0