0
votes

this error is show my in angularjs code

" angular.min.js:7 Uncaught Error: [$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%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%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%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) at angular.min.js:7 at angular.min.js:43 at q (angular.min.js:8) at g (angular.min.js:42) at hb (angular.min.js:46) at c (angular.min.js:22) at Vc (angular.min.js:22) at ye (angular.min.js:21) at angular.min.js:340 at HTMLDocument.b (angular.min.js:38)"?

the html code is

<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>

the javascript code is

<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>

what is the solution I observe the code more and I can not find the error.

2

2 Answers

0
votes

You need to have the references in the following order,

(i) You should load angular.js first and then anguarjs router reference

  <script type="text/javascript" src="angular.min.js"></script>
  <script type="text/javascript" src="angular-route.min.js"></script>
0
votes

You have misspelled $routeProvider

The URL in the error actually give you hint.

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%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%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%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)