Im building a MVC web app. There are two main sections that will function as single-page applications. Two different MVC layouts are used, one for each different scenario (one with a menu on the side, one with a full screen). Long story short - ive got 2 different Angular modules also, each scoped to the level of the main layout thats being used.
question:
With Angular - using the routeProvider, is the path referenced with the promise relative to the Angular app context, or the site url as a whole ? So I re-read the Angular tutorial on routing, and I'm still not sure, so I posted the question here.
In other words, when a url is selected by the browser and the root of that url brings in a new Angular module, does angular see its base as that new url, or the root url of the site? Basically, this is a question about routing when dealing with multiple modules/apps.
When setting up the 2nd module, I had my MVC controller working but when I went to setup the route for its angular controller, the MVC view would display but not the Angular view I had defined. See snippets below.
MVC route is: /rating (what you see in the browser address window)
Angular incorrect route:
var app = angular.module('ratingIndex', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider.when("/rating", {
controller: "ratingController",
templateUrl: "templates/ratingView.html"
});
$routeProvider.otherwise({ redirectTo: "/" });
});
MVC route is: /rating (what you see in the browser address window)
Angular correct route:
var app = angular.module('ratingIndex', ['ngRoute']);
app.config(function ($routeProvider) {
$routeProvider.when("/", {
controller: "ratingController",
templateUrl: "templates/ratingView.html"
});
$routeProvider.otherwise({ redirectTo: "/" });
});