I am working on a small app using Angular which has of two modules.
The target is to enable modules on different pages of an app.
For example:
http://domain.com/app1/#routesOfApp1
http://domain.com/app2/#routesOfApp2
How can I make sure that routesOfApp1
are not available on http://domain.com/app2/
? Is it even possible?
I know that one of the ways is to create two completely separate angular apps and load them respectively. But, I would love to keep it as a one big app, as at some point, I am planning to transition this whole thing into single page app across the board.
What are my options?
Thanks,
If i understand correctly you need to use requirejs. When you clicked http://domain.com/app1/routesOfApp1, routesOfApp1.html and its angularjs controller (routesOfApp1Controller.js) will load. (there is nothing for app2)
sampleApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/app1/routesOfApp1', {
templateUrl: 'app1/routesOfApp1.html',
controller: 'routesOfApp1Controller'
}).
when('/app2/routesOfApp2', {
templateUrl: 'app2/routesOfApp2.html',
controller: 'routesOfApp2Controller'
}).
otherwise({
redirectTo: '/default'
});
}]);
http://www.codeproject.com/Articles/808213/Developing-a-Large-Scale-Application-with-a-Single