var myApp = angular.module("myApp", ["ngRoute"]);
myApp.config(function ($locationProvider) {
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
});
myApp.config(function ($routeProvider) {
$routeProvider
.when("", {
templateUrl: "Views/Employee/Employees.html",
controller: "EmployeesController"
}).otherwise({ redirectTo: 'Views/Employee/Employees' });
});
它路由了否则提到的URL,而不是.when
中提到的URL答案 0 :(得分:0)
Angular应用的根路线为"/"
,而不是""
。
然后,redirectTo
将路由提供程序中定义的路由作为值。
myApp.config(function ($routeProvider) {
$routeProvider
.when("/", {
templateUrl: "Views/Employee/Employees.html",
controller: "EmployeesController"
})
.otherwise({ redirectTo: '/' });
});