Everything works until the variables are renamed while minimizing ...

1) When we go to the root of the application http: // localhost: 8080 / , the error Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! takes off Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!

 App.config([ '$stateProvider', '$urlRouterProvider', '$locationProvider', 'localStorageServiceProvider', function ($stateProvider, $urlRouterProvider, $locationProvider, localStorageServiceProvider) { _log('App config ...'); $locationProvider.html5Mode(true); localStorageServiceProvider .setPrefix('SA'); localStorageServiceProvider .setStorageType('localStorage'); $urlRouterProvider .when('/', '/stat') .when('/stat/','/stat') .otherwise("/404"); }]); 

There are no observers of the state and its direct change in the application.

To check added:

 var App = angular.module("app", [ 'app.auth', 'app.stat', 'ui.bootstrap', 'ui.router', 'LocalStorageModule', 'ngAnimate', 'angularMoment' ]).run([ '$rootScope', '$state', '$stateParams', 'amMoment', function($rootScope, $state, $stateParams, amMoment) { _log('App run ...'); $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams, options) { _log('$stateChangeStart: ', arguments); }); amMoment.changeLocale('ru'); $rootScope.$state = $state; $rootScope.$stateParams = $stateParams; } ]); 

that's why I see that $ stateChangeStart works 5 times and gives an error ...

2) If I enter or refresh the http: // localhost: 8080 / stat page

Everywhere strictly adhere to the style

 ['inject1', 'inject2', function(inject1, inject2) { /* somecode */ }] 

There are no errors in the FF and Chrome consoles.

at uglify({ mangle: false }) everything works ...

Mistake:

 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [] http://errors.angularjs.org/1.4.9/$rootScope/infdig?p0=10&p1=%5B%5D minErr/<@http://localhost:8080/libs/angular/angular.js?1455281609647:68:12 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://localhost:8080/libs/angular/angular.js?1455281609647:16133:1 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8080/libs/angular/angular.js?1455281609647:16359:13 done@http://localhost:8080/libs/angular/angular.js?1455281609647:10791:36 completeRequest@http://localhost:8080/libs/angular/angular.js?1455281609647:10989:7 requestLoaded@http://localhost:8080/libs/angular/angular.js?1455281609647:10930:1 @chrome://firebug/content/lib/wrapper.js:112:43 consoleLog/<@http://localhost:8080/libs/angular/angular.js?1455281609647:12722:18 $ExceptionHandlerProvider/this.$get</<@http://localhost:8080/libs/angular/angular.js?1455281609647:9490:7 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8080/libs/angular/angular.js?1455281609647:16361:13 done@http://localhost:8080/libs/angular/angular.js?1455281609647:10791:36 completeRequest@http://localhost:8080/libs/angular/angular.js?1455281609647:10989:7 requestLoaded@http://localhost:8080/libs/angular/angular.js?1455281609647:10930:1 @debugger eval code:1:1 consoleLog/<@http://localhost:8080/libs/angular/angular.js?1455281609647:12722:18 $ExceptionHandlerProvider/this.$get</<@http://localhost:8080/libs/angular/angular.js?1455281609647:9490:7 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://localhost:8080/libs/angular/angular.js?1455281609647:16361:13 bootstrapApply@http://localhost:8080/libs/angular/angular.js?1455281609647:1680:9 invoke@http://localhost:8080/libs/angular/angular.js?1455281609647:4535:14 bootstrap/doBootstrap@http://localhost:8080/libs/angular/angular.js?1455281609647:1678:1 bootstrap@http://localhost:8080/libs/angular/angular.js?1455281609647:1698:1 angularInit@http://localhost:8080/libs/angular/angular.js?1455281609647:1592:5 @http://localhost:8080/libs/angular/angular.js?1455281609647:29652:5 n.Callbacks/j@http://localhost:8080/libs/jquery/dist/jquery.min.js?1455281609647:2:26920 n.Callbacks/k.fireWith@http://localhost:8080/libs/jquery/dist/jquery.min.js?1455281609647:2:27738 .ready@http://localhost:8080/libs/jquery/dist/jquery.min.js?1455281609647:2:29530 I@http://localhost:8080/libs/jquery/dist/jquery.min.js?1455281609647:2:29721 

$ stateChangeStart:

 Object { name="$stateChangeStart", targetScope=Scope, defaultPrevented=false, ещё...} Object { templateUrl="pages/stat/list/template.html", controller="statListCtrl", name="stat.list", url="" } Object {} Object { url="^", abstract=true, name="", views=null } Object {} Object { location=false, inherit=true, notify=true, ещё...} 

Tell me which way to look?

  • try to remove: .when('/stat/','/stat') - Grundy
  • in addition, after the error text itself, there is another description or stack, add it to the question too - Grundy
  • @Grundy, tried, does not help the cause. I'll add a stack now - Alexey Lemesh
  • and it would not be bad with what arguments 5 times is called $ stateChangeStart - Grundy
  • @Grundy, the arguments are always the same. - Alexey Lemesh

1 answer 1

resolve a map object

https://github.com/angular-ui/ui-router/wiki#resolve

Does not work:

 resolve: [ '$q', '$rootScope', function(a, b) { /* code */ } ] 

Works:

 resolve: { "data": [ '$q', '$rootScope', function(a, b) { /* code */ } ]} 

Angular takes the argument parameter as an object, and reads it as a pair of "key": "value" / "promise" In the first option, with minification, services are simply lost.

  • look at what he minifits this all - Grundy
  • @Grundy, modified the minified file line by line ... - Alexey Lemesh am