M
M
Max2015-07-29 12:52:01
Angular
Max, 2015-07-29 12:52:01

What's wrong with routing in Angular?

Hello, tell me what to fix, otherwise on the forums in the solution, only adding the file
angular-route.js and registering 'ngRoute' in the module. I added the file, registered it in the module ..
Actually, here is a piece of code:

var app = angular.module('Flapper', ['ngRoute']);
app.config(['$routeProvider',  function($routeProvide){
  $routeProvide
  .when('/',{templateUrl: '/partials/show.html', controller: 'addAppCtrl'})
  .when('/view/:id',{templateUrl: '/partials/view.html' , controller: 'viewCntrl'})
  .otherwise({redirectTo:'/'});
}]);

Oh yes, it gives this error: Error: $injector:modulerr

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey, 2015-07-29
@maxprof

https://docs.angularjs.org/error/$injector/modulerr
check again if your angular-route or any other module you are using is loaded. Perhaps the application is initialized before the module is loaded.

B
Bohdan Stadnyk, 2015-07-29
@Humble_Beck

app.config(['$routeProvider',  function($routeProvide){

$routeProvider

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question