- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我的应用出现以下错误
Error: [$rootScope:infdig] http://errors.angularjs.org/1.4.1/$rootScope/infdig?p0=10&p1=%5B%5D
at m.prototype.$digest (https://localhost:44301/angular.min.js:132:501)
at m.prototype.$apply (https://localhost:44301/Scripts/angular.min.js:135:159)
at Anonymous function (https://localhost:44301/Scripts/angular.min.js:19:315)
at e (https://localhost:44301/Scripts/angular.min.js:39:10)
at d (https://localhost:44301/Scripts/angular.min.js:19:236)
at zc (https://localhost:44301/Scripts/angular.min.js:20:23)
at Yd (https://localhost:44301/Scripts/angular.min.js:18:342)
at Anonymous function (https://localhost:44301/Scripts/angular.min.js:289:159)
at j (https://localhost:44301/js/jquery/jquery-2.1.1.min.js:2:26852)
at k.fireWith (https://localhost:44301/js/jquery/jquery-2.1.1.min.js:2:27609)
它只会在应用程序启动时抛出一次,在我登录到我的事件目录后,该应用程序在所有 View 中都能正常工作。
我的 app.js 是这样的:
(function () {
angular.module('inspinia', [
'ui.router', // Routing
'oc.lazyLoad', // ocLazyLoad
'ui.bootstrap', // Ui Bootstrap
'pascalprecht.translate', // Angular Translate
'ngIdle', // Idle timer
'AdalAngular', // ADAL JS Angular
'ngRoute' // Routing
])
})();
和我的 config.js 的一部分
function config($stateProvider, $urlRouterProvider, $ocLazyLoadProvider, IdleProvider, KeepaliveProvider, adalAuthenticationServiceProvider, $httpProvider) {
// Configure Idle settings
IdleProvider.idle(5); // in seconds
IdleProvider.timeout(120); // in seconds
$urlRouterProvider.otherwise("/dashboards/dashboard_1");
$ocLazyLoadProvider.config({
// Set to true if you want to see what and when is dynamically loaded
debug: true
});
$stateProvider
.state('dashboards', {
abstract: true,
url: "/dashboards",
templateUrl: "views/common/content.html",
})
.state('dashboards.dashboard_1', {
url: "/dashboard_1",
templateUrl: "views/dashboard_1.html",
requireADLogin: true,
resolve: {
loadPlugin: function ($ocLazyLoad) {
return $ocLazyLoad.load([
{
serie: true,
name: 'angular-flot',
files: ['js/plugins/flot/jquery.flot.js', 'js/plugins/flot/jquery.flot.time.js', 'js/plugins/flot/jquery.flot.tooltip.min.js', 'js/plugins/flot/jquery.flot.spline.js', 'js/plugins/flot/jquery.flot.resize.js', 'js/plugins/flot/jquery.flot.pie.js', 'js/plugins/flot/curvedLines.js', 'js/plugins/flot/angular-flot.js', ]
},
{
name: 'angles',
files: ['js/plugins/chartJs/angles.js', 'js/plugins/chartJs/Chart.min.js']
},
{
name: 'angular-peity',
files: ['js/plugins/peity/jquery.peity.min.js', 'js/plugins/peity/angular-peity.js']
}
]);
}
}
})
adalAuthenticationServiceProvider.init(
{instance: 'https://login.microsoftonline.com/',
tenant: 'mysaasapp.onmicrosoft.com',
clientId: '33e037a7-b1aa-42ab-9693-6c22d01ca338',
extraQueryParameter: 'nux=1'
//cacheLocation: 'localStorage', // enable this for IE, as sessionStorage does not work for localhost.
},
$httpProvider
);
}
angular
.module('inspinia')
.config(config)
.run(function ($rootScope, $state) {
$rootScope.$state = $state;
});
我的index.html
<!--
* INSPINIA - Responsive Admin Theme
* Version 2.0
*
-->
<!DOCTYPE html>
<html ng-app="inspinia">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Page title set in pageTitle directive -->
<title page-title></title>
<!-- Font awesome -->
<link href="font-awesome/css/font-awesome.css" rel="stylesheet">
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Main Inspinia CSS files -->
<link href="css/animate.css" rel="stylesheet">
<link id="loadBefore" href="css/style.css" rel="stylesheet">
</head>
<!-- ControllerAs syntax -->
<!-- Main controller with serveral data used in Inspinia theme on diferent view -->
<body ng-controller="MainCtrl as main">
<!-- Main view -->
<div ui-view></div>
<!-- jQuery and Bootstrap -->
<script src="js/jquery/jquery-2.1.1.min.js"></script>
<script src="js/plugins/jquery-ui/jquery-ui.js"></script>
<script src="js/bootstrap/bootstrap.min.js"></script>
<!-- MetsiMenu -->
<script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
<!-- SlimScroll -->
<script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<!-- Peace JS -->
<script src="js/plugins/pace/pace.min.js"></script>
<!-- Custom and plugin javascript -->
<script src="js/inspinia.js"></script>
<!-- Main Angular scripts-->
<script src="Scripts/angular.min.js"></script>
<script src="js/plugins/oclazyload/dist/ocLazyLoad.min.js"></script>
<script src="js/angular-translate/angular-translate.min.js"></script>
<script src="js/ui-router/angular-ui-router.min.js"></script>
<script src="https://code.angularjs.org/1.2.25/angular-route.js"></script>
<script src="js/bootstrap/ui-bootstrap-tpls-0.12.0.min.js"></script>
<script src="js/plugins/angular-idle/angular-idle.js"></script>
<!--
You need to include this script on any page that has a Google Map.
When using Google Maps on your own site you MUST signup for your own API key at:
https://developers.google.com/maps/documentation/javascript/tutorial#api_key
After your sign up replace the key in the URL below..
-->
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDQTpXj82d8UpCi97wzo_nKXL7nYrd4G70"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="js/adal/adal.min.js"></script>
<script src="js/adal/adal-angular.js"></script>
<!-- Anglar App Script -->
<script src="js/app.js"></script>
<script src="js/config.js"></script>
<script src="js/translations.js"></script>
<script src="js/directives.js"></script>
<script src="js/controllers.js"></script>
</body>
</html>
和我的 content.html
<!-- Wrapper-->
<div id="wrapper">
<!-- Navigation -->
<div ng-include="'views/common/navigation.html'"></div>
<!-- Page wraper -->
<!-- ng-class with current state name give you the ability to extended customization your view -->
<div id="page-wrapper" class="gray-bg {{$state.current.name}}">
<!-- Page wrapper -->
<div ng-include="'views/common/topnavbar.html'"></div>
<!-- Main view -->
<div ui-view></div>
<!-- Footer -->
<div ng-include="'views/common/footer.html'"></div>
</div>
<!-- End page wrapper-->
<!-- Right Sidebar -->
<div ng-include="'views/common/right_sidebar.html'"></div>
</div>
<!-- End wrapper-->
我能够通过 ADAL.JS 将问题过滤掉
如果我删除 requireadlogin 行和 .init 行来配置身份验证,错误就消失了。
最佳答案
.run(function ($rootScope, $state) {
$rootScope.$state = $state;
});
当您尝试增加 $rootScope 时发生错误。该错误表明他正在进入一个非常大的循环,并且出于安全原因,angular 自己中止了您的请求。
如果您想将两个或更多值添加到根作用域中,为什么不尝试使用 .push 函数并将所有数据保存到一个数组中呢?
关于javascript - 错误 : [$rootScope:infdig] http://errors. angularjs.org/1.4.1/$rootScope,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30993860/
为什么在此示例中需要 $rootScope.$apply() 来使用页面上的 ng-hide 更新元素? 根据我的经验,每当我将 $scope.$apply() 放入 $scope.$watch 中时
$rootScope 和$rootScope.$root 有区别吗? 有什么区别 $rootScope.global.flag = true 和 $rootScope.$root.global.fla
我想在我的应用程序中共享这些功能,而我的工厂很少。问题是我必须在需要时在每个 Controller 中添加所有这些工厂。随着工厂和 Controller 数量的增加,这是一项乏味的任务! 因此我试图找
我在 $rootScope 上定义了一个方法 $rootScope.method = function(value){ // wanna give this value to `$scope.
我想知道我是否可以在 $rootScope.$on 函数中调用 $rootScope.$emit,原因是我有两个 Controller ctrl1.js 和`ctrl2.js,我想在我的 ctrl1.
谁能帮助理解 $rootScope.$new() 和 $rootScope.$new(true) 之间的区别?根据我的理解,它们应该是相同的,因为 $rootScope 没有父作用域。 最佳答案 $n
在广播和接收广播方面, Angular 1.2 rc2 和 Angular 1.2 之间有什么变化吗? 我有我认为是 $watch Controller 中的标准广播,即 $scope.$wa
我在我的应用程序中将 UI-router 用于嵌套 View ,但同时我想在路由更改时监听事件。在使用 UI-router routeChangeSuccess 之前,它触发得很好,但在 ui-rou
嗨,我想知道在性能方面什么更好。 假设我有一个广播东西的工厂: angular.module('core.foo') .factory('Foo', ['$rootScope',
我在 App.run 中定义了一些模型下面我在 Controller 中覆盖 someCtrl : App.run(['$rootScope', function($rootScope) { $r
我的应用出现以下错误 Error: [$rootScope:infdig] http://errors.angularjs.org/1.4.1/$rootScope/infdig?p0=10&p1=%
在一个 Controller 中,我这样做: $rootScope.$emit("newAction", {}); 在另一个 Controller 我做: $rootScope.$on('newAct
我想将数据从一个 Controller 发送到另一个 Controller 。其实我已经关注了这个link 我的第一个 Controller 是这样的: class ProductCtrl const
用户注销后,我需要清理我的 $rootScope。我试过 $rootScope.$destroy()但这并没有奏效。有没有办法遍历 $rootScope 中的所有值并删除它们或简单地重置它的方法? 最
抱歉,我的英语不好。我有 angularjs 应用程序,有很多页面和表单。对于任何页面,使用该页面的模型创建文件。示例: file userDict.js: $rootScope.dicts.user
当互联网不可用时,我想在每个页面上显示互联网不可用栏。 我正在使用 Ionic 框架,因此决定将代码保留在 menu.html 上 这是我的菜单 html 代码 Internet not availa
我在我的 Controller $rootScope.$on 函数中监听用户登录 $rootScope.$on('$firebaseSimpleLogin:login',functio
我在 Controller 中使用 $rootScope.$on 来监听我正在使用的模块(Angular-packery)发出的事件。它正在工作,它获取事件并且我可以在“args”上执行操作。但我想做
以下文件“有效”(即它不会引发任何错误): angular.module("modx", [], function($routeProvider) {
我有一个更新 $rootScope 的 Angular 服务。更新实际上工作正常,但它在控制台中抛出一个错误,这让我很担心。 app.service("scroll", function($rootS
我是一名优秀的程序员,十分优秀!