Hey there!
An issue popped up when I tried to pass an empty array as a model in my Angular project. The error message reads: "Argument of type 'any[]' is not assignable to parameter of type 'PollModel'. Property 'pollId' is missing in type 'any[]'." Can someone please assist me with this error? As a newbie to Angular, any guidance would be greatly appreciated.
HTML:
<button type="button" (click)="showAddModal('add',[])"> Create a poll</i></button>
Component:
showAddModal(action: string, poll: PollModel) {
//show add modal method
}
Model:
export class PollModel {
pollId: string;
pollName: string;
pollDesc: string;
pollOwnerId: string;
startDate: Date;
endDate: Date;
createdDate: Date;
modifiedDate: Date;
pollType: string;
}
I am trying to pass an empty array as a model. However I got the error above. I am new to angular. Any help will be appreciated.