1
我有我的應用程序設置與視圖的路線,一個$routeProvider
爲:角是印刷的,而不是渲染局部的
angular.module('myApp', [])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/authorisation', { template: 'templates/authorisation.html', controller: AuthenticationController})
.otherwise('templates/404.html');
}]);
我index.html
是:
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<title>Gift Cloud Dash</title>
<script src="lib\angular\angular.js"></script>
<!-- App config -->
<script src="js\app.js"></script>
<!-- Import controllers -->
<script src="js\controllers\authentication-controller.js"></script>
</head>
<body>
<div>
<a href="#/authorisation">Authorisation</a>
</div>
<div ng-view></div>
</body>
</html>
當我打開索引頁面,我看到超鏈接,但是當我單擊它時,將顯示文件路徑而不是它在<div ng-view></div>
中呈現。
使用'templateUrl',而不是'模板' – madhead
乾杯,不知道我從那裏得到了! – BanksySan