I've created an interface in Angular 4 called StatusDetail:
interface StatusDetail {
statusName: string,
name: string
}
Next, I assigned some values to it within an Angular component:
//Angular Component
export class EditComponent implements OnInit{
statusDetail: StatusDetail;
ngOnInit() {
this.statusDetail.statusName = 'text Status';
this.statusDetail.name= 'text Name';
}
}
Now, I want to reset the statusDetail object to null using a method:
SetNull() {
this.statusDetail = null
}
Unfortunately, when attempting to set it to null, I get the following error:
Type null is not assignable to type StatusDetail
How can I resolve this issue?