Type "Contasml" is Missing from type Contasml[]: length, pop, Concat and 26 more

Asked

Viewed 20 times

0

I’m having the following error in my visual studio code editor: Type "Contasml" is Missing from type Contasml[]: length, pop, Concat and 26 more

My model:

export class ContasML{
    id: number
    email: string;
    senha: string;
}   

Initialization:

  contasML: ContasML[] = new Array();

I should call the cancel functionOperacaoContaML to clear the screen fields, I try to create a new instance of the class

  cancelaOperacaoContaML(){
    this.contasML = new ContasML();
  } 

1 answer

2


You are assigning an object to a variable declared as Array. Whereas you want an array, update your method to the following:

cancelaOperacaoContaML(){
  this.contasML = new Array<ContasML>();
} 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.