无法读取未定义的属性“ viewContainer”

时间:2020-07-16 22:43:33

标签: angular angular-material lazy-loading

我只是将应用程序从Angular 5升级到Angular 10。

注意:我注意到所有其他导航都有效。因此,如果我有10条路线。.1,3,5,7条路线有效..其他失败。

我有两个正在加载的组件..都完全相同..一个加载,另一个出现此错误:

core.js:4081 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'viewContainer' of undefined
TypeError: Cannot read property 'viewContainer' of undefined
    at MatTable.ngOnDestroy (table.js:1227)
    at executeOnDestroys (core.js:9095)
    at cleanUpView (core.js:9017)
    at destroyViewTree (core.js:8812)
    at destroyLView (core.js:8970)
    at RootViewRef.destroy (core.js:9704)
    at ComponentRef$1.destroy (core.js:22341)
    at RouterOutlet.deactivate (router.js:4950)
    at ActivateRoutes.deactivateRouteAndOutlet (router.js:2157)
    at ActivateRoutes.deactivateRouteAndItsChildren (router.js:2138)
    at resolvePromise (zone-evergreen.js:798)
    at resolvePromise (zone-evergreen.js:750)
    at zone-evergreen.js:860
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Object.onInvokeTask (core.js:27137)
    at ZoneDelegate.invokeTask (zone-evergreen.js:398)
    at Zone.runTask (zone-evergreen.js:167)
    at drainMicroTaskQueue (zone-evergreen.js:569)
    at ZoneTask.invokeTask [as invoke] (zone-evergreen.js:484)
    at invokeTask (zone-evergreen.js:1621)

这是我正在使用的软件包:

"dependencies": {
    "@angular/animations": "~10.0.4",
    "@angular/cdk": "^10.0.2",
    "@angular/common": "~10.0.4",
    "@angular/compiler": "~10.0.4",
    "@angular/core": "~10.0.4",
    "@angular/forms": "~10.0.4",
    "@angular/http": "^7.2.16",
    "@angular/material": "^10.0.2",
    "@angular/platform-browser": "~10.0.4",
    "@angular/platform-browser-dynamic": "~10.0.4",
    "@angular/router": "~10.0.4",
    "@ngrx/effects": "^9.2.0",
    "@ngrx/entity": "^9.1.0",
    "@ngrx/store": "^9.2.0",
    "angular-froala-wysiwyg": "^3.1.1-1",
    "bootstrap": "^4.5.0",
    "chart.js": "^2.7.2",
    "core-js": "^3.6.5",
    "font-awesome": "^4.7.0",
    "lodash": "^4.17.5",
    "moment": "^2.22.0",
    "ngrx-signalr-core": "^8.2.0",
    "ngx-bootstrap": "^5.6.1",
    "ngx-toastr": "^13.0.0",
    "node-sass": "^4.14.1",
    "npm": "^6.14.6",
    "rxjs": "^6.6.0",
    "rxjs-compat": "^6.0.0-rc.0",
    "simple-line-icons": "^2.4.1",
    "ts-helpers": "^1.1.2",
    "tslib": "^2.0.0",
    "update": "^0.7.4",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1000.3",
    "@angular/cli": "~10.0.3",
    "@angular/compiler-cli": "~10.0.4",
    "@types/jasmine": "^3.5.11",
    "@types/lodash": "^4.14.106",
    "@types/node": "^14.0.23",
    "codelyzer": "^6.0.0",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-cli": "^2.0.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~3.3.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.10.2",
    "tslint": "~6.1.0",
    "typescript": "~3.9.6"
  },

0 个答案:

没有答案