zonejs

zone.js violation warnings on console in Angular project only on Chrome

徘徊边缘 提交于 2019-12-02 22:34:18
I've an Angular 4 project created using @angular/cli , when running the application in development mode, I receive those warnings in the console: zone.js:1489 [Violation] 'setTimeout' handler took 209ms 2[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. zone.js:1157 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. zone.js:1157 [Violation] Added non-passive event

Patching Element.prototype.addEventListener breaks any Angular 2 app

我的未来我决定 提交于 2019-12-02 20:51:17
问题 I have an Angular 2 app https://github.com/DanWahlin/Angular-JumpStart. I tried to patch Element.prototype.addEventListener for some of my use case. Here is the patch: var origLis = Element.prototype.addEventListener; Element.prototype.addEventListener = function(type, handler, useCapture) { console.log("Added"); return origLis.apply(this, arguments); } If I patch Element.prototype.addEventListener , it breaks the Angular 2 app. No resources/XHRs are being sent in the app. I tried this on

Angular Reactive Form : Cannot set property of undefined

半世苍凉 提交于 2019-12-02 17:21:30
问题 I'm stuck with Angular5 ReactiveForm. Actually, I create a basic model sub sub.model.ts : export interface Subscription { name: string; } I also have a component : : sub.component.ts import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Sub } from '@models/sub.model'; @Component({ selector: 'md-subscribe', templateUrl: './subscribe.component.html', styleUrls: ['./subscribe.component.scss'] }) export class SubComponent

Zone.assertZonePatched is not a function

痴心易碎 提交于 2019-12-01 15:02:11
I am getting the error message: Unhandled Promise rejection: Zone.assertZonePatched is not a function Although I am importing zonejs correctly in index.html: <script src="https://unpkg.com/zone.js@0.6.17/dist/zone.js"></script> Here is the code: Plnkr: http://plnkr.co/edit/zZYOcgxcRINx23JhuxOk?p=preview What is wrong here? RC7 Update zone.js pakage by zone.js@0.6.21 <script src="https://unpkg.com/zone.js@0.6.21/dist/zone.js"></script> Angular2.0 release Update zone.js package by zone.js@0.6.23 , <script src="https://unpkg.com/zone.js@0.6.23?main=browser"></script> Update package.json file

Zone.assertZonePatched is not a function

家住魔仙堡 提交于 2019-12-01 13:51:49
问题 I am getting the error message: Unhandled Promise rejection: Zone.assertZonePatched is not a function Although I am importing zonejs correctly in index.html: <script src="https://unpkg.com/zone.js@0.6.17/dist/zone.js"></script> Here is the code: Plnkr: http://plnkr.co/edit/zZYOcgxcRINx23JhuxOk?p=preview What is wrong here? 回答1: RC7 Update zone.js pakage by zone.js@0.6.21 <script src="https://unpkg.com/zone.js@0.6.21/dist/zone.js"></script> Angular2.0 release Update zone.js package by zone.js

angular 2 change detection and ChangeDetectionStrategy.OnPush

与世无争的帅哥 提交于 2019-11-27 06:49:32
I'm trying to understand the ChangeDetectionStrategy.OnPush mechanism. What I gather from my readings is that a change detection works by comparing the old value to the new value. That comparison will returns false if the object reference hasn't changed. However there seems to be certain scenarios where that "rule" is bypassed. Could you explain how does it all work ? Okay, since this took me a whole evening to understand I made a resume to settle everything in my head and it might help future readers. So let's start by clearing some things up: Changes come from events A component might have

angular 2 change detection and ChangeDetectionStrategy.OnPush

匆匆过客 提交于 2019-11-26 10:28:29
问题 I\'m trying to understand the ChangeDetectionStrategy.OnPush mechanism. What I gather from my readings is that a change detection works by comparing the old value to the new value. That comparison will returns false if the object reference hasn\'t changed. However there seems to be certain scenarios where that \"rule\" is bypassed. Could you explain how does it all work ? 回答1: Okay, since this took me a whole evening to understand I made a resume to settle everything in my head and it might