In my angular6 application,
I have declared empty array as below:
conversation=[]
and I have constructor in shared module where it does initialize the object of conversation below is the code
export class messageThread {
internalId?: number;
unreadMessageCount?: number;
subject?: string;
managerCode?: string;
constructor(json?: any) {
if ( !json ) return;
this.internalId= json.internalId || 0;
this.unreadMessageCount=json.internalId || 0;;
this.subject = json.internalId || '';
this.managerCode =json.managerCode|| '';
}
}
However when in my ts file if I do like below.
this.conversation = new dataModel.messageThread ();
it gives me error: saying that only push, pop can be used, I know that this is because I have initialized it with empty array and it does expect array as an assignment, is there any way we can assign object to an empty array or I am missing something here
pushto the conversation the new Object.