NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.87k stars 3.94k forks source link

nz-modal Cannot read property 'nativeNode' of null #5328

Closed wangxg6 closed 4 years ago

wangxg6 commented 4 years ago

Steps to reproduce

"dependencies": {
        "@angular/animations": "^9.1.9",
        "@angular/cdk": "^9.2.4",
        "@angular/common": "^9.1.9",
        "@angular/compiler": "^9.1.9",
        "@angular/core": "^9.1.9",
        "@angular/elements": "^9.1.9",
        "@angular/forms": "^9.1.9",
        "@angular/localize": "^9.1.9",
        "@angular/platform-browser": "^9.1.9",
        "@angular/platform-browser-dynamic": "^9.1.9",
        "@angular/router": "^9.1.9",
        "@webcomponents/custom-elements": "^1.4.1",
        "aes-js": "^3.1.2",
        "angular-highcharts": "^9.0.11",
        "angulartics2": "^9.0.1",
        "core-js": "^3.6.5",
        "crypto-js": "^4.0.0",
        "hammerjs": "^2.0.8",
        "highcharts": "^8.1.0",
        "immer": "^6.0.5",
        "jquery": "^3.2.1",
        "lodash": "^4.17.15",
        "lodash-es": "^4.17.10",
        "lru_map": "^0.3.3",
        "measure-font": "^1.0.0",
        "moment": "^2.24.0",
        "net": "^1.0.2",
        "ng-zorro-antd": "^9.1.2",
        "raven-js": "^3.27.2",
        "rxjs": "^6.5.3",
        "toastr": "^2.1.4",
        "tslib": "^1.10.0",
        "zone.js": "~0.10.2"
    },

打开弹框,关闭弹框后控制台报错,升级了多个项目,就一个项目有这个问题,稳定复现,任何一个弹框都会有这样的问题

What is expected?

弹框关闭

What is actually happening?

弹框关闭,报错 TypeError: Cannot read property 'nativeNode' of null at removeDebugNodeFromIndex (core.js:30099) at DebugRenderer2.push../nodemodules/@angular/core/fesm5/core.js.DebugRenderer2.destroyNode (core.js:32384) at destroyViewNodes (core.js:31600) at destroyView (core.js:31588) at callViewAction (core.js:31706) at execEmbeddedViewsAction (core.js:31649) at destroyView (core.js:31578) at callWithDebugContext (core.js:32324) at Object.debugDestroyView [as destroyView] (core.js:32026) at ViewContainerRef.push../nodemodules/@angular/core/fesm5/core.js.ViewContainerRef.clear (core.js:22245) at NgIf.push../node_modules/@angular/common/fesm5/common.js.NgIf._updateView (common.js:3522) at NgIf.set [as ngIf] (common.js:3478) at updateProp (core.js:22883) at checkAndUpdateDirectiveInline (core.js:22638) at checkAndUpdateNodeInline (core.js:31501) at checkAndUpdateNode (core.js:31463) at debugCheckAndUpdateNode (core.js:32100) at debugCheckDirectivesFn (core.js:32060)

Environment Info
ng-zorro-antd 9.1.2
Browser chrome 81.0.4044.138

build 和功能都不受影响,只是控制台报错

wangxg6 commented 4 years ago
<nz-modal
    *ngIf="showModal"
    [nzVisible]="true"
    (nzOnCancel)="showModal = false"
>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
</nz-modal>
wangxg6 commented 4 years ago

image

mdragoss commented 4 years ago

This problem is not related to nz-modal , maybe your register twice nzModalModule

wangxg6 commented 4 years ago

This problem is not related to nz-modal , maybe your register twice nzModalModule

but when i use ng-zorro-antd 8.x it has not this error

wangxg6 commented 4 years ago

This problem is not related to nz-modal , maybe your register twice nzModalModule

i import NgZorroAntdModule twice in different module,thx

hsuanxyz commented 4 years ago

I will reopen so that others with the same problem can find it until it fixed.