Click function with a variable of a model

1

Ie personally, I have model getting the value of a web api perfectly, but the problem is that I have a function that I need to get the value of model and put in the click function as parameter and it gives the following error:

    Uncaught Error: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 13 in [PegarValores({{pesquisas.Codigo}})] in ng:///AppModule/FormpesquisaComponent.html@37:49

I do not know if I'm calling the model the right way, but I'll put the code below the model, and html for a better understanding of the problem:

HTML

<button class="btn btn-info" (click)="PegarValores({{pesquisas.Codigo}})">
  <i class="glyphicon glyphicon-ok" style="color:green;"></i>Iniciar
</button>

MODEL

export class Pesquisa {
    public Codigo: number;
    public Id: number;
    public Nome: string;
}
    
asked by anonymous 15.06.2018 / 15:45

1 answer

2

No angulation within the method does not need the brackets.

<button class="btn btn-info" (click)="PegarValores(pesquisas.Codigo)">
  <i class="glyphicon glyphicon-ok" style="color:green;"></i>Iniciar
</button>
    
15.06.2018 / 16:00