I'm currently working with Angular, and I've encountered an issue while trying to assign a value to a key within my model. Here's a snippet of my code:
export class aa{
types: bb[];
}
export interface bb{
name: string;
age: string;
}
In my TypeScript file, I attempted the following:
newType: bb;
initValues(){
this.newType.name = 'Anna'; //error at this line
}
However, when running the code, I received an error stating
"cannot get property of undefined"
.
Can someone please guide me on where I might be going wrong? How do I properly assign a value to a key in Angular?