why I am getting this error Cannot set property 'title' of undefined here is my code https://stackblitz.com/edit/angular-pkd3qr?file=src%2Fapp%2Fapp.component.ts
import { Component } from '@angular/core';
interface DropDownModel {
displayName: string;
value: string;
}
interface DropdownModelWithtitle {
title: string;
dropDownOptions: DropDownModel[];
}
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
name = 'Angular';
typeOfProofObj: DropdownModelWithtitle;
constructor(){
this.typeOfProofObj.title = "ss";
this.typeOfProofObj.dropDownOptions = [{displayName:'ss',value:'sss'}];
}
}
I am trying to insert the value into my variable, so how to resolve this issue?