我想重定向到應用程序的另一個頁面。與我們在MVC應用程序或asp.net應用程序中採用的方式類似。我已經定義了下面的Route.js文件。以下列方式定義我想重定向到另一個頁面使用角度JS
route.js
var MainApp=angular.module('RoutingApp', ['ngRoute'])
.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider
.when('/BusinessAgent', {
templateUrl: 'Views/BusinessAgent/BusinessAgent.html',
controller: 'BusinessAgentController'
})
.when('/Admin', {
templateUrl: 'Views/Admin/Admin.html'
})
.otherwise({
redirectTo: '/'
});
$locationProvider.html5Mode({
enabled: true,
requireBase: false
});
}]);
HTML頁面
<section id="banner">
<ul class="actions">
<li>
<a href="#BusinessAgent" class="button big">Business Agent</a>
</li>
</ul>
</section>
在HREF的點擊就應該redirect.But它不被重定向。
在控制檯中的任何錯誤? –