Angular Js Error in Safari 5.0.1: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: []

时间:2016-07-11 19:15:47

标签: javascript ruby-on-rails angularjs devise

I am new to AngularJS. Developing an small app using MEAN Stack but getting following error in Safari 5.0.1 but working fine in Firefox, Chrome and Safari 5.1.*

 [$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
 http://bstr8wme.herokuapp.com/assets/application-175206184d524de9fc32c12db5ad32ba.js:6

 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

Tried many suggestions by googling. And, disabled all functionalities except login/register, even disabled Devise/Auth as well to test only the login/register page load. Nothing works for me.

Some of my files:

application.js

//= require jquery
//= require jquery_ujs
//= require underscore
//= require angular
//= require angular-animate
//= require angular-cookies
//= require angular-resource
//= require angular-route
//= require angular-touch
//= require angular-ui-router
//= require ./angular/app
//= require_tree ./angular

app.js.erb

var app = angular.module("appname", [
'ngAnimate',
'ngCookies',
'ngResource',
'ngRoute',
'ngTouch',
'ui.router',

]);

app.config(
    [
        '$stateProvider',
        '$routeProvider',
        '$locationProvider',
        function ($stateProvider, $routeProvider, $locationProvider) {
            $stateProvider
                    .state('home', {
                        url: '/',
                        templateUrl: "<%= asset_path('public/home.html.erb') %>",
                        controller: 'MainCtrl'
                    });

            $routeProvider
                    .when('/login', {
                        templateUrl: "<%= asset_path('users/login.html') %>",
                        controller: 'AuthCtrl'
                    })
                    .when('/register', {
                        templateUrl: "<%= asset_path('users/registration.html') %>",
                        controller: 'AuthCtrl'
                    })
                    .otherwise(function ($injector) {
                        var $state = $injector.get('$state');
                        $state.go('home');
                    });

            $locationProvider.html5Mode({
                enabled: true,
                requireBase: false
            });
        }
    ]);

app.config(['$httpProvider', function ($httpProvider) {
    $httpProvider.defaults.headers.common['X-CSRF-Token'] = $('meta[name=csrf-token]').attr('content');
}]);

AuthCtrl

app.controller('AuthCtrl', [
'$scope',
'$rootScope',
'$state',
'$http',
function ($scope, $rootScope, $state, $http) {
    $scope.login = function () {
    };

    $scope.register = function () {
    };
}]);

MainCtrl

app.controller("MainCtrl", [
    '$scope',
    '$rootScope',
    '$timeout',
    '$location',
    function ($scope, $rootScope, $timeout, $location) {
    }
]

);

Can anyone please go through the app hosted on heroku - http://bstr8wme.herokuapp.com and provide possible fix.

Thanks in advance for help!

0 个答案:

没有答案