0

I want to create multiple apps within one app that will be hosted on the same server.

I am using the following link as a guide but I am unsure how to implement some of it: Muliple spas

I have the app setup as follows:

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

Each index page has its own ng-app. I am using grunt-contrib-connect to serve the application for development. I have a middleware setup to default to 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;
            }

When I run the application app1 works as expected, but I am unsure how to navigate to app2 and have it bootstrap.

If I change the middleware to default to app2 it also works as expected so both apps run fine on their own.

How can i move to app2 and have it bootstrap? Do I need to map it someway in grunt-contrib-connect?

I have tried simply navigating to app2 using a href and $window.location.href but to no avail.

Community
  • 1
  • 1
AngularBoy
  • 1,715
  • 2
  • 25
  • 35
  • Under the apps/ folder, you can have multiple javascript files that contains angular.module. Should not be a problem. The name of the modules need to be different ofcourse! – Jagrut Jan 11 '16 at 14:26
  • there is mutliple angular.modules. The problem is navigating between them since there is muliple ng-apps. – AngularBoy Jan 11 '16 at 15:10

0 Answers0