Ad

Angular Module Failed To Load

For some reason my module failed to load. I dont understand It says:

Uncaught Error: [$injector:modulerr] https://docs.angularjs.org/error/$injector/modulerr?p0=reddit-clone&p1=Error:%20%5B$injector:unpr%5D%20http:%2F%2Ferrors.angularjs.org%2F1.2.26%2F$injector%2Funpr%3Fp0%3D%2524routeProvider%0A%20%20%20%20at%20Error%20(native)%0A%20%20%20%20at%20http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:6:450%0A%20%20%20%20at%20http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:36:202%0A%20%20%20%20at%20c%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:34:305)%0A%20%20%20%20at%20Object.d%20%5Bas%20invoke%5D%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:35:6)%0A%20%20%20%20at%20http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:33:394%0A%20%20%20%20at%20r%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:7:290)%0A%20%20%20%20at%20e%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:33:207)%0A%20%20%20%20at%20gc%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:36:309)%0A%20%20%20%20at%20c%20(http:%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.2.26%2Fangular.min.js:18:170

Yeah a preety big https that is basically saying if you recieve this error your module failed to load. Please help, here is my code:

index.html:

<!DOCTYPE html>
<html lang="en">

<head>
<link rel="stylesheet" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- AngularJS -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular-route.min.js"></script>
<!-- Firebase -->
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
<!-- AngularFire -->
<script src="https://cdn.firebase.com/libs/angularfire/1.1.3/angularfire.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body style="margin:20px">
  <h1 style = "text-align:center"> Reddit Clone</h1>
  <div ng-view></div>
</body>
</html>

app.js:

var app = angular.module('reddit-clone' , ['ngRoute', 'firebase'])

app.config(function($routeProvider){
  $routeProvider.when('/',{
      controller:'MainController'
      templateUrl:'main.html'
  })
          .otherwise({
      redirectTo:'/'
  })
})

app.controller('MainController', function($scope, firebase){


})

main.html:

<h1>Hey Guys this is cool</h1>
Ad

Answer

You also need to specify ng-app in the shell.

<body ng-app="reddit-clone" style="margin:20px">
Ad
source: stackoverflow.com
Ad