<!DOCTYPE html>
<html>
<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>
//<script src="js/angular.js"></script>
</head>
<body ng-app="ngView">
<p ng-view>
</p>
<script type="text/javascript">
angular.module('ngView', [],
function($routeProvider){
$routeProvider
.when('/',
{
templateUrl: 'demo.html'
}
)
.when('/test1',
{
templateUrl: 'demo.html'
}
)
.when('/test2',
{
templateUrl:'slindex.html'
}
);
}
);
</script>
</body>
</html>
When importing angular files through CDN, it can be implemented in Firefox browser, but not in Chrome. When importing angular through local files, prompt:
Uncaught Error: [$injector:modulerr] Failed to instantiate module ngView due to:
Error: [$injector:unpr] Unknown provider: $routeProvider
http://errors.angularjs.org/1.3.16/$injector/unpr?p0=$routeProvider
at file:///C:/wamp/www/js/angular.js:63:12
at file:///C:/wamp/www/js/angular.js:4031:19
at getService (file:///C:/wamp/www/js/angular.js:4178:39)
at Object.invoke (file:///C:/wamp/www/js/angular.js:4210:13)
at runInvokeQueue (file:///C:/wamp/www/js/angular.js:4125:35)
at file:///C:/wamp/www/js/angular.js:4134:11
at forEach (file:///C:/wamp/www/js/angular.js:326:20)
at loadModules (file:///C:/wamp/www/js/angular.js:4115:5)
at createInjector (file:///C:/wamp/www/js/angular.js:4041:11)
at doBootstrap (file:///C:/wamp/www/js/angular.js:1455:20)
http://errors.angularjs.org/1.3.16/$injector/modulerr?p0=ngView&p1=Error:…otstrap (file:///C:/wamp/www/js/angular.js:1455:20)