Error: No module: ngRoute when trying to implement routing in angularjs

app = angular.module("dithat", ["ngRoute", "ngResource", 'ng-rails-csrf']);
  app.config(['$routeProvider',
  function($routeProvider) {
  $routeProvider.
  when('/', {
    templateUrl: 'app/views/layouts/_user_page.html',
    controller: 'accomplishmentController'
  });
}]);

Am I missing something? Thanks!


ANSWERS:


Have you included the angular-route.js file in your page? And are you using angular 1.2.0 - the module doesn't seem to exist prior to this.

See


Add angular-route into application.js like

in /app/assets/javascripts/application.js

//= require angular
//= require angular-resource
//= require angular-route

Remove ngRoute from our dependency injection as you are already injecting routeProvider in config

app = angular.module("dithat", ["ngResource", 'ng-rails-csrf']);
  app.config(['$routeProvider',
  function($routeProvider) {
  $routeProvider.
  when('/', {
  templateUrl: 'app/views/layouts/_user_page.html',
  controller: 'accomplishmentController'
});
}]);


 MORE:


 ? angular2 - Pass value from parent route to child route
 ? How to initiate MixItUp with AngularJS NgRoute
 ? "Controller as" syntax for ng-view
 ? Angular2 routing issue and ngOnInit called twice
 ? Angular app not loading CSS and JS on refreshing page?
 ? can't find angular route js on google cdn
 ? $routeProvider error with angularJS
 ? AngularJS, $routeProvider
 ? "Uncaught Error: [$injector:unpr]" with angular after deployment
 ? Angular throw an error 'uncaught object' on page load