TypeScript+AngularJs:-如何在单个路由文件中定义多个路由

TypeScript+AngularJs:-How to define multiple routes in a single route file

我已经使用 typescript 和 angular js 实现了一个模块,其中我有多个页面我想每个 page.than 使用一个 typescript 控制器我如何像现在一样在我的路线中定义它们只定义了一个,但是如果我有 6 到 7 个控制器和页面 too.I 在下面显示了我的代码怎么办:-

/// <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" });
        }

        }
    }

使用这个语法:

$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" 
});

让他们链接到 $routeProvider.when

/// <reference path="../scripts/typings/tsd.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"
             })
    .when("/home", {
     templateUrl: "partials/home.aspx",
     controller: "home.controller"
    });
    
            $routeProvider.otherwise({ redirectTo: "/search" });
        }

        }
    }