This is my read.html page where users fill out a form and submit it.
<form class="mt-3 text-center" (ngSubmit)="onSubmit()">
<div class="text-center">
<input type="text" name="barcode" class="form-control text-center mt-2" [(ngModel)]="barcode" placeholder="Barcode">
</div>
</form>
In my read.ts file, the form submission triggers a service call to retrieve information.
constructor(private ticketlineservice: TicketlineService,
private activatedRoute: ActivatedRoute) {
this.activatedRoute.queryParams.subscribe(params => {
this.codEspec = params['CodEspec'];
this.DiaHoraEspecs = params['DiaHoraEspecs'];
});
}
ngOnInit() {
}
onSubmit(){
console.log(this.barcode,this.codEspec,this.DiaHoraEspecs );
this.ticketlineservice.CheckTicket(this.barcode, this.codEspec, this.DiaHoraEspecs).subscribe(reads => {
this.reads = reads[0].Tickets;
console.log(reads);
});
}
This is the function of the service I am calling. The additional parameters (codEspec and DiaHoraEspecs) are obtained from a previous URL.
CheckTicket(barcode, codEspec, diaHoraEspec):Observable<Ticket[]>{
//get all events
return this.http.get<Ticket[]>(`${this.url_node_tickets}${this.barcode}${this.codEspec}${this.diaHoraEspec}`, httpOptions);
}
Issue: While the correct values are displayed in the console log, the barcode value does not update in the URL.