FIREBASE警告:用户回调引发异常。错误:[$rootScope:inprog]http://errors.angularjs.org/1.4.7/$rootScope/inprog?p0=%24摘要
我得到了一个错误,随机的,有时发生,有时不发生。 我无法确定要修复的问题 是否有人知道错误原因或如何预防 我的代码:FIREBASE警告:用户回调引发异常。错误:[$rootScope:inprog]http://errors.angularjs.org/1.4.7/$rootScope/inprog?p0=%24摘要,angularjs,firebase,firebase-util,Angularjs,Firebase,Firebase Util,我得到了一个错误,随机的,有时发生,有时不发生。 我无法确定要修复的问题 是否有人知道错误原因或如何预防 我的代码: angular.module('VigiApp').controller('FeedsController', ['$scope', 'gettextCatalog', 'FirebaseURL', '$ngBootbox', function($scope, gettextCatalog, FirebaseURL, $ngBootbox) { $scope.conten
angular.module('VigiApp').controller('FeedsController', ['$scope', 'gettextCatalog', 'FirebaseURL', '$ngBootbox', function($scope, gettextCatalog, FirebaseURL, $ngBootbox) {
$scope.contents = [];
isSpinnerBar(false);
$scope.init = function(){
isSpinnerBar(true);
// Get a database reference to our posts
//auth
var fbAuth = FirebaseURL.getAuth();
//Ref
var norm = new Firebase.util.NormalizedCollection(
FirebaseURL.child('contents'),
[FirebaseURL.child('categories'), 'category', 'contents.category_id']
);
// get a reference we can use like a normal Firebase instance
ref = norm.select('contents.category_id',
'contents.dt_created',
'contents.num_comment',
'contents.num_favorite',
'contents.text',
'contents.photos',
'contents.user_id',
{key: 'category.name.$value', alias: 'category_name'},{key: "category."+$scope.currentLanguage+".$value", alias: 'category_name_language'},{key: 'category.icon.$value', alias: 'category_icon'}).ref();
// Attach an asynchronous callback to read the data at our posts reference
ref.orderByChild("dt_created").limitToFirst(2).on("value", function(snapshot) {
console.log(snapshot.val());
var res = snapshot.val();
$scope.$apply(function() {
$scope.contents = res;
isSpinnerBar(false);
isButtonActivedFeed();
});
}, function (errorObject) {
console.log("The read failed: " + errorObject.code);
isSpinnerBar(false);
});
}
$scope.share = function(e){
}
}]);
警告:
FIREBASE WARNING: Exception was thrown by user callback. Error: [$rootScope:inprog] http://errors.angularjs.org/1.4.7/$rootScope/inprog?p0=%24digest
....
注视
例外情况:
附属的
=(好的,为这篇文章道歉,我在谷歌上搜索了很多之后找到了一个解决方案 我正在寻找firebase或firebase util,但在页面之间导航时,我的angular是一个错误 解决方案对我有效:
var res = snapshot.val();
$timeout(function(){
$scope.$apply(function() {
$scope.contents = res;
isSpinnerBar(false);
isButtonActivedFeed();
});
});
解决方案、原因:
请,如果其他人有同样的问题/疑问,我会保留这个问题