我是角度和学习角度v1 +的新手。刚刚看到一个示例,该示例显示了当所有控制器位于同一文件中时如何通过路由加载控制器。
代码来自https://scotch.io/tutorials/single-page-apps-with-angularjs-routing-and-templating
int[] arrayInt = new int[100];
for (int i = 0; i < arrayInt.Length; i++)
{
arrayInt[i] = int.Parse(Console.ReadLine());
if (arrayInt[i] == Convert.ToChar (ConsoleKey.N))
{
//for example
Console.WriteLine("You pressed n");
}
// script.js
// create the module and name it scotchApp
// also include ngRoute for all our routing needs
var scotchApp = angular.module('scotchApp', ['ngRoute']);
// configure our routes
scotchApp.config(function($routeProvider) {
$routeProvider
// route for the home page
.when('/', {
templateUrl : 'pages/home.html',
controller : 'mainController'
})
// route for the about page
.when('/about', {
templateUrl : 'pages/about.html',
controller : 'aboutController'
})
// route for the contact page
.when('/contact', {
templateUrl : 'pages/contact.html',
controller : 'contactController'
});
});
// create the controller and inject Angular's $scope
scotchApp.controller('mainController', function($scope) {
// create a message to display in our view
$scope.message = 'Everyone come and see how good I look!';
});
scotchApp.controller('aboutController', function($scope) {
$scope.message = 'Look! I am an about page.';
});
scotchApp.controller('contactController', function($scope) {
$scope.message = 'Contact us! JK. This is just a demo.';
});
现在我的问题是,如果关于和联系控制器驻留在不同文件夹中的不同文件夹中那么当用户点击链接时角度路由将如何加载这些模块?
那么请告诉我如何指示角度路由以在带有路径的不同模块中加载控制器?
请用一个小例子来讨论。感谢