0
Could someone help me pass the content of an input text to a function at the angle?
my html is:
<form class= "form mt-4">
<mat-card>
<mat-card-header>
<mat-card-title>{{ 'buscaAtestado' | translate }}</mat-card-title>
</mat-card-header>
<div class="text-center mb-3">
<i class="fa fa-search mr-2"></i>
<input [value]="filter" class= "rounded mb-3" type="search" placeholder="search..." autofocus>
<section fxLayout="row" fxLayout.xs="column" fxLayoutWrap class="container" fxLayoutAlign="center center" fxLayoutGap="20px" fxLayoutGap.xs="20px">
<button type="button" mat-raised-button class="download" (click)="baixarTodos()">{{ 'baixarAtestados' | translate}}</button>
<button type="reset" mat-raised-button class="limpar" (click)="onClean()"> {{ 'limpar' | translate }}</button>
<button type="submit" mat-raised-button class="pesquisar" (click)="onSearch()">{{ 'pesquisar' | translate }}</button>
</section>
</div>
</mat-card>
and my:
@Component({
selector: 'app-atestado',
templateUrl: './atestado.component.html',
styleUrls: ['./atestado.component.scss']
})
export class AtestadoComponent implements OnInit {
filter: string= '';
constructor(
private projetoService: ProjetoService) {}
ngOnInit(): void {
}
onSearch(){
console.log(this.filter)
}
The best thing would be to use ngModel or the reactive Forms
– Eduardo Vargas