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
2
votes
1 answer

Ngx-leaflet Leaflet, angular 5 lot of Function Call from zone.js

I am using ngx-leaflet, when adding markers to the map, the application slows down due to the large amount of Function Call (zone.js). I tried to use changeDetection and ngZone but to no avail. Please help :) constructor(zone: NgZone)…
Blackboy
  • 192
  • 2
  • 20
2
votes
1 answer

Can NgZone be used to detect "idle" state of Angular application?

Let's say we have Angular 5+ app and I would want to run certain "jobs" (like loading more of data from server via API call) during idle times when we are mostly sure the user is not doing anything (as we also control inputs through input…
Sergey Rudenko
  • 8,809
  • 2
  • 24
  • 51
2
votes
2 answers

Angular server side rendering issue [Zone already loaded]

I am able to build app for server side rendering but when i run server.ts file i get this error. Commands: "build:ssr": "npm run build:client-and-server-bundles && npm run webpack:server", "serve:ssr": "node…
2
votes
1 answer

Angular 4 Removal of EventListeners in zone.js

I am currently working with Angular 4 which uses zone.js natively to monitor activity on the DOM. In my Angular application I am getting zone.js errors: [Violation] 'keydown' handler took 209ms - zone.js I do not want to disable zone.js from…
dbrant
  • 21
  • 3
2
votes
1 answer

Timer Fired event is pending

I have some code for swipe gesture, the main parts are: this.topSlide = this.elementRef.nativeElement.querySelector('.product_rate_slide'); if (this.topSlide) { this.topSlide.addEventListener('touchstart', this.handleTouchStart); …
Tzach Ovadia
  • 1,278
  • 9
  • 18
2
votes
1 answer

Webpack two applications in one bundle, Angular requires Zone.js

Hello everyone I am building two angular applications in one bundle with webpack. The applications are in the src folder. Here is my webpack config const commonConfig = require('./webpack.common.js'); const webpack =…
Jordy
  • 165
  • 1
  • 3
  • 12
2
votes
1 answer

Why the component does not detect internal state change without `changeDetetectorRef.markForCheck`?

General I have a problem. My component does not re-render without calling changeDetectorRef.markForCheck method. I have an autocomplete. When input changes I send some async request (just simple HttpClient service and get method). After that, I fill…
Sharikov Vladislav
  • 7,049
  • 9
  • 50
  • 87
2
votes
1 answer

Using fakeAsync in tests results in error with Angular 4 and Zone.js

I'm using Angular 4.3.1 and zone.js 0.8.14 and I'm running my tests, with karma and webpack and came across this weird error in my tests whenever I'm using fakeAsync and tick for time-related tests. The test case: it('should call the function which…
gerhard
  • 427
  • 1
  • 4
  • 12
2
votes
1 answer

Unhandled Promise rejection: Zone.js

I keep getting this error in developer tools and its been driving me mental for the past few days. Unhandled Promise rejection: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten. So I've read and tried…
Waldo Rabie
  • 31
  • 1
  • 5
2
votes
0 answers

What causes xhr cancellations by zone.js in Angular 2

I am having trouble pinpointing why some of my state store dispatches after async REST calls are sometimes not being fired. One thing I notice is in the network panel, I will often get an xhr (cancelled) initiated by zone.js Anybody know what…
user2410939
  • 195
  • 1
  • 1
  • 7
2
votes
0 answers

Are there any methods to isolate zone.js from other code?

There is an issue: There is a client code and I should use an angular based widget on the page. So angular uses zone.js and this one affects all global async methods, but it brakes the client scripts. The question is: Can I start the zone in an…
yiooxir
  • 327
  • 3
  • 7
2
votes
1 answer

Jasmine tests with Angular 2 and Node not working

I have installed the ng-fullstack generator and selected the options for Angular 2 and Node. Everything plays nicely... apart from the tests. When I try to execute the tests they fail. Any search I have done tells me what a downgrade of zone.js to…
Creights
  • 907
  • 1
  • 12
  • 25
1
vote
0 answers

Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten. on Angular Universal SSR application

I am working on developing an Angular application with SSR (using Angular Universal) and when launching the application on the remote server I get this error: Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been…
1
vote
1 answer

Generic component where projected content is instantiated in outer zone

I have a webcomponent that for perf reasons needs to run outside angular. I came up with the basic idea : @Component({ selector: 'run-outer-zone', template: '' }) class OuterZoneComponent { constructor(private vcr: ViewContainerRef, private…
Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
1
vote
1 answer

Angular change detection runs unexpectedly, based on the expressions order in the view

I am just playing with Angular change detection cycle and I found something that I can't understand. We have following component's view:

call(); {{ call() }}

Name obtained from the API: {{…