我目前正在增加角度,並試圖使動態路由工作。角度路由提供程序不執行
注:我已經看過了這個問題:How to defer routes definition in Angular.js?,我相信我做的這一切狀態,但我仍然得到錯誤「未知提供商:$ routeProvider」
我在做什麼錯?
HTML:
<!doctype html>
<html ng-app="rProvider">
<head>
<link rel="stylesheet" href="css/style.css">
<script src="lib/angular/angular.js"></script>
<script src="js/routeProviderTest.js"> </script>
</head>
<body>
<div ng-controller="rControl">
<h2>Route Controller Test</h2>
[<a href="r1">Route 1</a> | <a>Route 2</a>]
<hr/>
<span class="partial-info">
Partial: {{routeValue}}
</span>
<div ng-view></div>
<small>The Bottom</small>
</div>
</body>
</html>
JS:
var myAppModule = angular.module('rProvider',[]);
myAppModule.config(function($routeProvider){
$routeProvider.when("r1",{templateUrl:"/route1.html"});
});
myAppModule.controller('rControl', function($scope, $route){
$scope.routeValue = 'nothing yet';
});
在此先感謝...
創建普拉克或的jsfiddle展現問題 –
@Sarah我同意劉燁的看法,我沒有看到任何明顯的表現,你做錯了。這個問題可能與你正在使用的Angular版本有關(我相信他們已經開始打破新版本的最新版本)。角色團隊已經決定推進到第2版,他們將拆分Angular框架的所有部分,以便開發人員可以決定他們想要的部分並將其餘部分留下(減輕負載並允許更多的互操作性) – shaunhusain