我有一个 Angular 8 应用程序。但是我收到这个错误:在一个组件上。它是一个组件中的一个组件。如果组件为空,则将显示错误,如果组件不为空,则不会显示错误
:4200/dossier-dossier-module-ngfactory.js:186 ERROR TypeError: Cannot read property 'length' of null
at DossierCorrespondenceItemComponent.push../src/app/dossier/dossier-correspondence-item/dossier-correspondence-item.component.ts.DossierCorrespondenceItemComponent.ngOnInit (:4200/dossier-dossier-module-ngfactory.js:100)
at checkAndUpdateDirectiveInline (vendor.js:37850)
at checkAndUpdateNodeInline (vendor.js:46063)
at checkAndUpdateNode (vendor.js:46025)
at debugCheckAndUpdateNode (vendor.js:46659)
at debugCheckDirectivesFn (vendor.js:46619)
at Object.updateDirectives (:4200/dossier-dossier-module-ngfactory.js:189)
at Object.debugUpdateDirectives [as updateDirectives] (vendor.js:46611)
at checkAndUpdateView (vendor.js:46007)
at callViewAction (vendor.js:46248)
在这个组件上:
<app-dossier-correspondence-item
[item]="single"
(goBack)="goBack($event)"
*ngIf="showingSingle">
</app-dossier-correspondence-item>
</app-vital10-page>
这是 ts 代码:
import { Component, OnInit } from '@angular/core';
import { HealthAPIService } from '../../shared/health-api/health-api.service';
import { DossierEntry } from '../../interfaces/dossier/dossier-entry.interface';
@Component({
selector: 'app-dossier-correspondence',
templateUrl: './dossier-correspondence.component.html',
})
export class DossierCorrespondenceComponent implements OnInit {
allCorrespondence: Array<DossierEntry>;
correspondenceEntries: Array<DossierEntry>;
attachmentEntries: Array<DossierEntry>;
message = '';
emptyMessage = 'Geen correspondentie.';
errorMessage = 'Er ging iets mis met de connectie. Probeer over enkele minuten nogmaals.';
correspondenceLoaded = false;
showingSingle = false;
single: DossierEntry;
那么如何解决这个问题呢?谢谢你。所以会很好地解决这个问题
红颜莎娜
相关分类