此错误是在angularjs代码中显示我的
“ angular.min.js:7未捕获的错误:[$ injector:modulerr] http://errors.angularjs.org/1.7.2/ $ injector / modulerr?p0 = myapp&p1 = Error%3A%20%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.7.2%2F%24injector%2Funpr% 3Fp0%3D%2524routeProvidor%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A7%3A168%0A%20%20%20%20%20at%20http%3A% 2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A46%3A215%0A%20%20%20%20at%20d%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A43%3A433) %0A%20%20%20%20at%20e%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A44%3A171)%0A%20%20%20%20at%20Object.invoke% 20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A44%3A256)%0A%20%20%20%20at20at%20d%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min .js%3A42%3A407)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A43%3A19%0A%20%20%20%20%20at%20q% 20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A8%3A76)%0A%20%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min .js%3A42%3A308)%0A%20%20%20%20at%20 hb%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A46%3A401) 在q的angular.min.js:7处在q的angular.min.js:43 在hb的g(angular.min.js:42)处(angular.min.js:8) (c)(angular.min.js:22)在Vc(angular.min.js:22) (angular.min.js:22)在ye(angular.min.js:21)在 HTMLDocument.b上的angular.min.js:340(angular.min.js:38)“?
html代码是
<html ng-app="myapp">
<head>
<title></title>
<script type="text/javascript" src="angular-route.min.js"></script>
<script type="text/javascript" src="angular.min.js"></script>
</head>
<body>
<div ng-view=""></div>
javascript代码是
<script >
(function()
{
var mod=angular.module("myapp",['ngRoute']);
mod.config(function($routeProvidor){
$routeProvidor.when('/view1',
{
templateUrl:"view1.html",
controller:"view1_ctr"
}).when('/view2',
{
templateUrl:"view2.html",
controller:"view2_ctr"
});
})
})()
</script>
什么是解决方案?我会更多地观察代码,但找不到错误。
答案 0 :(得分:0)
您拼错了$ routeProvider
错误中的URL实际上会给您提示。
http://errors.angularjs.org/1.7.2/ $ injector / modulerr?p0 = myapp&p1 = Error%3A%20%5B%24injector%3Aunpr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.7.2%2F%24injector %2Funpr%3Fp0%3D%2524routeProvidor%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A7%3A168%0A%20%20%20%20%20at%20http %3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A46%3A215%0A%20%20%20%20at%20d%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A43 %3A433)%0A%20%20%20%20at%20e%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A44%3A171)%0A%20%20%20%20%20at%20Object .invoke%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A44%3A256)%0A%20%20%20%20%20at%20d%20(http%3A%2F%2Flocalhost%2Fapp_angularjs% 2Fangular.min.js%3A42%3A407)%0A%20%20%20%20at%20http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A43%3A19%0A%20%20%20%20at %20q%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A8%3A76)%0A%20%20%20%20%20at%20g%20(http%3A%2F%2Flocalhost%2Fapp_angularjs% 2Fangular.min.js%3A42%3A308)%0A%20%20%20%20at %20hb%20(http%3A%2F%2Flocalhost%2Fapp_angularjs%2Fangular.min.js%3A46%3A401)
答案 1 :(得分:0)
您需要按以下顺序获取参考
(i)您应该先加载angular.js,然后再加载anguarjs路由器参考
<script type="text/javascript" src="angular.min.js"></script>
<script type="text/javascript" src="angular-route.min.js"></script>