angular.js - AngularJs透過定義錨點連結控制頁面輸出
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | <code><!DOCTYPE html>
<html ng-app= "ngView" >
<head>
<title>分页显示</title>
<meta charset= "utf-8" >
<script src= "http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" ></script>
<script src= "http://code.angularjs.org/angular-1.0.1.min.js" ></script>
</head>
<body>
<p ng-view>
<p ng-controller= "test" >
</p>
</p>
<script type= "text/javascript" >
angular.module( 'ngView' , [],
function ( $routeProvider ){
$routeProvider .when( '/test1' ,
{
templateUrl: 'demo.html' ,
controller: 'test'
}
)
.when( '/test2' ,
{
templateUrl: 'slinder.html' ,
controller: 'test'
}
);
}
);
</script>
</body>
</html>
</code>
|
擋在url中輸出/#/test1時demo.html沒有顯示,請問是什麼情況? ?