你好,以前我使用了角6,在迁移到角8之后,这是完成的,但有时它会给我带来错误。
main.js:11770 Error: Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.
Most likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)
at Function.assertZonePatched (polyfills.js:2901)
at new NgZone (vendor.js:80474)
at getNgZone (vendor.js:81501)
at PlatformRef.bootstrapModuleFactory (vendor.js:81344)
at vendor.js:81419
at scripts.js:22096package.json
"dependencies": {
"@angular/animations": "^8.0.3",
"@angular/cdk": "^8.2.3",
"@angular/common": "~8.0.0",
"@angular/compiler": "~8.0.0",
"@angular/core": "~8.0.0",
"@angular/forms": "~8.0.0",
"@angular/platform-browser": "~8.0.0",
"@angular/platform-browser-dynamic": "~8.0.0",
"@angular/router": "~8.0.0",
"@ng-bootstrap/ng-bootstrap": "^5.1.4",
"@ng-idle/core": "^8.0.0-beta.4",
"@ng-idle/keepalive": "^8.0.0-beta.4",
"@ng-select/ng-select": "^3.6.0",
"@types/highcharts": "^7.0.0",
"@types/jquery": "^3.3.31",
"ag-grid-community": "^21.2.2",
"angular-calendar": "^0.27.20",
"angular2-draggable": "^2.3.2",
"angular2-highcharts": "^0.5.5",
"angular2-moment": "^1.9.0",
"chart.js": "^2.9.2",
"crypto-js": "^3.1.9-1",
"date-fns": "^1.30.1",
"exceljs": "^3.3.1",
"export-to-csv": "^0.2.1",
"file-saver": "^2.0.2",
"jquery": "^3.4.1",
"jspdf": "^1.5.3",
"jspdf-autotable": "^3.2.10",
"moment": "^2.24.0",
"ng-circle-progress": "^1.5.1",
"ng2-charts": "^2.3.0",
"ng2-order-pipe": "^0.1.5",
"ng2-pdf-viewer": "^6.0.2",
"ng2-search-filter": "^0.5.1",
"ngx-bootstrap": "^5.2.0",
"ngx-daterangepicker-material": "^2.1.8",
"ngx-pagination": "^4.1.0",
"ngx-toastr": "^11.2.1",
"ngx-tooltip": "0.0.9",
"ngx-ui-switch": "^8.2.0",
"number-to-words": "^1.2.4",
"primeicons": "^2.0.0",
"primeng": "^8.1.1",
"quill": "^1.3.6",
"rxjs": "~6.4.0",
"rxjs-compat": "^6.5.3",
"ts-xlsx": "0.0.11",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},当我发现错误后,我安装了与我的项目相关的所有依赖项,当我研究了来自互联网的许多资源之后,突然不知道发生了哪些依赖问题或任何其他问题--我在项目中实现了所有的解决方案,但没有执行ZoneAwarePromise错误
我找到了这个解决方案,即{ ngZone: 'noop'},它是main.ts文件
main.ts
platformBrowserDynamic()
.bootstrapModule(MainModule, { ngZone: 'noop'})
.catch(err => console.error(err));在我将这个{ ngZone: 'noop'}应用到中之后,main.ts文件中没有显示错误,但是我的Project没有调用。
所以请帮我解决问题出在哪里,我用的是角8和打字本版本~3.4.3
发布于 2019-11-25 18:51:16
我也遇到了同样的问题,我在这里找到了一个解决方案:https://medium.com/angular-in-depth/do-you-still-think-that-ngzone-zone-js-is-required-for-change-detection-in-angular-16f7a575afef
在组件中导入
从'@angular/core';
构造函数(私有_appService: ApplicationRef,){}
this._appService.tick();
这对我来说很管用。
抱歉,我的英语很差。
https://stackoverflow.com/questions/58801428
复制相似问题