I have implemented a module using typescript and angular js where i have multiple pages i want to use one typescript controller per page.than how can i define them in my routes as right now i have defined one only but what do to if i have 6 to 7 controllers and pages too.I have shown my code below:-
/// <reference path="../scripts/typings/angularjs/angular.d.ts" />
/// <reference path="../scripts/typings/angularjs/angular-route.d.ts" />
module CustomerSearch {
export class Routes {
static $inject = ["$routeProvider"];
static configureRoutes($routeProvider: ng.route.IRouteProvider) {
$routeProvider.when("/search", {
templateUrl: "search.aspx",
controller: "CustomerSearch.controllers.CustomerCtrl"
});
$routeProvider.otherwise({ redirectTo: "/search" });
}
}
}
Use this syntax:
$routeProvider.
when("/search", {
templateUrl: "search.aspx",
controller: "CustomerSearch.controllers.CustomerCtrl"
}).
when('/home', {
templateUrl: "home.aspx",
controller: "ControllerName"
}).
when('/contact', {
templateUrl: "contact.aspx",
controller: "ControllerName"
}).
otherwise({
redirectTo: "/search"
});