Angular module config not called
Angular module config not called
app/app.js
(This sample project coming from angular-seed)
// Declare app level module which depends on views, and components
angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
debugger;
$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/view1'});
}]);
Chrome debugger will not stop at debugger
, cause config
is not called.
That is becuase ng-app="myApp"
was missing from the root HTML element, usually at <html>
:
<html lang="en" ng-app="myApp" class="no-js">
Or maybe in <div>
element.
<div class="fuck-lfw" ng-app="myApp">
See http://stackoverflow.com/a/36063080/4685522 for the same mistake.