angularjs-digest

“TypeError: Illegal invocation” when trying to upgrade from v1.2

一世执手 提交于 2020-01-01 01:25:07
问题 Edit: It seems that this could be related to Chrome v43, I downgraded to v42 and everything works fine. Edit: I've submitted an issue on the Angular's Github repo. It seems that the error gets thrown by return logFn.apply(console, args); line 12221 in angular.js source. Here's a link to the Chromium bug. Any tips on what to do now? I'm trying to migrate my app from AngularJS v1.2 to either v1.3 or v1.4 but I'm getting TypeError: Illegal invocation on Chrome (tried win, osx and ubuntu). The

AngularJS / Firebase - Need to login twice for a successful login

你说的曾经没有我的故事 提交于 2019-12-25 02:59:37
问题 I have simple AngularJS app and using Firebase OpenAuth for user authentication. Here is a sample code from plunkr. [http://plnkr.co/edit/ZVfkaJF0g3E5u63J7uHx?p=preview][1] I have to click twice to authData from Google. I don't understand, why I can't get the data on the first click. 回答1: You need to apply digest cycle after receiving an event. $rootScope.$auth.$onAuth(function(authData){ $rootScope.authData = authData; $scope.$apply(); }); Forked Plunkr 来源: https://stackoverflow.com

“10 $digets() iterations reached” when trying to $http.post() from ng-translate error handler

余生长醉 提交于 2019-12-24 11:35:28
问题 We're using angular translate to handle localization of a web site, using our own custom loader that fetches translations from the server. On the server side, we have logic that handles missing translation keys so that we both return something (a translation from a fallback language or the key itself) and reports to the system that the key was requested (so it shows up in the translation UI elsewhere on the site). Now, I'm struggling with building something similar on the client side. The

Resolving promises without a digest cycle

心已入冬 提交于 2019-12-23 20:12:50
问题 AngularJS promises seem to be tied to a digest cycle, as in, the success/error callbacks are not called until a digest cycle is run. This means that anything that uses promises, such as $http or manually created promises, also need to trigger a digest cycle in order to get the callbacks to run. Is it possible to use promises in Angular, without the digest cycle being run at all? I realise you can use $applyAsync , which schedules the digest cycle for a bit later, but I'm looking to not run

The Url of dialog box does not work with angular.bootstrap (infinite $digest Loop)

两盒软妹~` 提交于 2019-12-23 09:27:41
问题 I have a mean-stack website. I want to use ExecuteFunction to bind a button to launch this website in a Dialog box: function doSomethingAndShowDialog(event) { clickEvent = event; Office.context.ui.displayDialogAsync("https://localhost:3000/try", {}, function () {}) } Clicking on the button opens a dialog box with the following url, it does show the content of the page: https://localhost:3000/try?_host_Info=excel|web|16.00|en-us|7fe9b4e9-d51e-bea5-d194-c817bc5ed4bc|isDialog#%2Ftry%3F_host_Info

Angular: why isn't $evalAsync called $applyAsync?

 ̄綄美尐妖づ 提交于 2019-12-22 05:37:06
问题 Angular beginner question about scopes (docs here). $eval executes an expression in the context of a scope. $apply basically calls $eval and then $digest . Why does $evalAsync call $digest too (or, more precisely, ensure $digest is called)? It seems to be that $ eval Async should really be called $ apply Async , doesn't it? I'm a beginner -- what am I missing? 回答1: $evalAsync and $applyAsync target to different situations. $evalAsync : defers the expression to the next loop iteration of

In what order do angular watchers and event listeners execute?

大城市里の小女人 提交于 2019-12-22 05:23:17
问题 If one changes a scope property first, and then broadcasts an event second, will the corresponding watcher callback and event listeners callback always be executed in that same order? For example: $scope.foo = 3; $scope.$broadcast('bar'); and elsewhere: $scope.$watch('foo', function fn1(){...}); $scope.$on('bar', function fn2(){...}); Will fn1 always be executed prior to fn2 , or visa-versa, or can the order not be relied upon? Please cite sources, preferably to official angular docs. In case

AngularJS watch element height change in directive

故事扮演 提交于 2019-12-12 02:38:00
问题 I realize there were several similar questions, I checked them but they don't seem to cover my case. So I have a fluid flexbox-based layout. Most of the window is used by container block, that shrinks when his siblings appear. Basically something like <body> <div class="menu"></div> <div class="contact"></div> <div class="container"></div> </body> the container height is not changed directly, it's recalculated by browser when I toggle other elements, such as menu . I want to watch the

What is about digest cycle in angular?

陌路散爱 提交于 2019-12-08 03:33:14
问题 Let we have the code in the control's method executed when, for example, we push a button $timeout(function() { $scope.names = ['A', 'B', 'C']; }, 0, false).then(function() { $scope.names.push('D'); }) in this case we will not see any changes at the screen because the digest cycle will not be running But if we wrote this $timeout(function() { $scope.names = ['A', 'B', 'C']; }, 0, false).then(function() { $scope.names.push('D'); return $q.when(); }) we will see changes because when we return

How to check if the digest cycles have stabilized (aka “Has angular finished compilation?”)

怎甘沉沦 提交于 2019-12-04 13:04:09
问题 tl;dr: The initial question was "How to trigger a callback every digest cycle?" but the underlying question is much more interesting and since this answers both, I went ahead and modified the title. =) Context: I'm trying to control when angular has finished compiling the HTML (for SEO prerendering reasons), after resolving all of its dependencies, ngincludes, API calls, etc. The "smartest" way I have found so far is via checking whether digest cycles have stabilized. So I figured that if I