It's my first time asking in the forum so if I'm doing something wrong please correct me.
I have the following excerpt from my HTML page:
Request:
<ion-list *ngFor = "let p of produtos | async">
<ion-input type = "text" [disabled] = "true" value = {{p.descricao}}></ion-input>
<ion-input type = "text" [disabled] = "true" value = {{p.preco}}></ion-input>
</ion-list>
And I would like to click the save button to pass as parameter the values generated by ngFor
<div padding>
<button ion-button type='submit' (click) = 'salvar(p.descricao, p.preco)'>
<ion-icon name="cash"></ion-icon>Comprar</button>
But whenever I click on it, it generates the following error:
ERROR TypeError: Cannot read property 'descricao' of undefined
at Object.eval [as handleEvent] (FinalizarPedidoPage.html:93)
at handleEvent (core.js:13589)
at callWithDebugContext (core.js:15098)
at Object.debugHandleEvent [as handleEvent] (core.js:14685)
at dispatchEvent (core.js:10004)
at core.js:10629
at HTMLButtonElement.<anonymous> (platform-browser.js:2628)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.js:4751)
at t.invokeTask (polyfills.js:3)
I have already noticed that the error is in passing the data as array, because if I only pass as a single value the function is executed normally.
How can I resolve this problem?