Questions tagged [zone.js]

A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.

Zone API is inspired by Dart and is developed along with Angular2.

https://github.com/angular/zone.js/

148 questions
22
votes
2 answers

How to stop errors generated by zone.js in browser console?

Here is my code in the httpService.ts public HttpPost(url: string, data: any): Observable { let headers = new Headers(); let reqOpts = new RequestOptions(); headers.append(AUTH_CONTENT_TYPE_KEY, AUTH_CONTENT_TYPE); if…
Haruka
  • 237
  • 1
  • 2
  • 7
16
votes
0 answers

Unhandled Promise rejection: timeout ; Zone: in angular 6

When I use ng-recaptcha component while routing to another route. Error is : Unhandled Promise rejection: timeout ; Zone: ; Task: Promise.then ; Value: timeout undefined Unhandled Promise rejection: timeout Zone: ; Task: Promise. then;…
16
votes
2 answers

Zones in angular

What are zones? How are angular ngZone differ from zone.js? When should they be used? Can someone help with practical examples of using ngZone? I've gone through angular documentation here however, I couldn't get complete…
Jyoti Prasad Pal
  • 1,569
  • 3
  • 26
  • 41
14
votes
1 answer

Purpose of zone.js/dist/zone-patch-rxjs

Probably I am too late with the question but anyway. Could someone explain me in what cases I need to import zone's patch - zone.js/dist/zone-patch-rxjs. As far as I know the patch was added in this PR (successor of this one). I use zone and RxJs in…
Sergey Sokolov
  • 2,709
  • 20
  • 31
12
votes
2 answers

Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten in custom element

I created a small app using angular custom elements feature (element.js), imported that element.js file into another angular(parent) app in index.html, in development server (ng serve) element feature works fine, but in production mode (ng build…
12
votes
2 answers

Angular 7 SSR - problems with NgZone

I've recently moved my company's website from React to Angular, since most our projects were already on Angular 7. Being the "use-the-latest-and-greatest" person that I am, I decided to implement server-side rendering to get the google page speed…
12
votes
1 answer

What are options to unit test requestAnimationFrame in Angular?

What are ways to unit test requestAnimationFrame? requestAnimationFrame has same nature as setTimeout/setInterval have. It is also patched by zone.js like fn's like setTimeout are patched. So options which first came to my mind are async +…
Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87
12
votes
2 answers

Rejecting a promise throws "Uncaught (in promise)"

I'm using promises to handle to handle a modal dialog: resolved when the user press the OK button, rejected when cancelled or closed. To resolve and dismiss the modal I use this methods: let modalResolve, modalReject; modal.promise = new…
Javier Marín
  • 2,166
  • 3
  • 21
  • 40
12
votes
3 answers

Karma + Jasmine: Cannot read property 'getComponentFromError'

I am following this tutorial: https://angular.io/guide/testing#component-test-scenarios for karma+jasmine unit testing. Here my code: import { AppComponent } from "./app.component"; import { ComponentFixture, TestBed } from…
laumonta
  • 153
  • 1
  • 1
  • 8
12
votes
1 answer

How to print path to the current Zone in zone.js

I'm experimenting with zones (zone.js) and I realized I don't know what's the best way to print all the zones from root to the current zone that threw an error. For example this code uses two nested callbacks with setTimeout() and then calls a…
martin
  • 93,354
  • 25
  • 191
  • 226
11
votes
5 answers

Testing | Cannot read property 'assertPresent' of undefined at resetFakeAsyncZone

I have a problem with karma v1.4. testing framework. All my unit tests are now failing with error Cannot read property 'assertPresent' of undefined at resetFakeAsyncZone I've already searched for solutions and tested them, but unfortunately none…
David Votrubec
  • 3,968
  • 3
  • 33
  • 44
11
votes
2 answers

Run ngrx/effect outside of Angular's zone to prevent timeout in Protractor

I just started to write e2e tests for my app and am running into timeout problems with Protractor and ngrx/effects. I have the following effect dispatching an action every couple of minutes: @Effect() setSessionTimer$ = this.actions$ …
Alexander Ciesielski
  • 10,506
  • 5
  • 45
  • 66
10
votes
3 answers

Running an observable into a zone.js

I have a GPS plugin providing locations out of an angular zone. The changes are therefore not detected by angular and the view keeps stuck with the same values. Of course, I could subscribe to this observable from the controller and do something…
Flavien Volken
  • 19,196
  • 12
  • 100
  • 133
7
votes
0 answers

Debug Jest tests inside Nrwl.nx Angular workspace with Visual Studio Code debugger

Im using Visual Studio Code, and Im trying to debug Jest tests inside of a Nrwl.Nx workspace for Angular. Here is what I've tried so far: launch.json { "version": "0.2.0", "configurations": [ { "type": "node", "request":…
user372225
  • 851
  • 2
  • 9
  • 23
7
votes
2 answers

Replacement for Domain in Nodejs?

I have read many threads related to this but they are a little bit old now, that's why as Domain is still Deprecated till now has anyone found any other good alternative to using Domain or not ?? I read this post alternative-to-domain-in-nodejs and…
Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94
1
2 3
9 10