How to combine my URL with data from my MYSQL

I have a database linked to the project with the variable {{PID}}. What I want is to create a function to open external files (URL) that contain this expression in the middle: To open a single file I have:

<ion-button (click)="abrirpdf('https://abcd.com/pids/RS-00020.pdf')">Open {{PID}}</ion-button>

I would like to know how to integrate the variable in my URL if possible, because it doesn’t work this way:

<ion-button (click)="abrirpdf('https://abcd.com/pids/RS-{{PID}}.pdf')">Open {{PID}}</i

Welcome to the forums.

Especially in an initial post, the three-word phrase “it doesn’t work” is generally pretty frustrating to read. What works better for people trying to help is more along the lines of:

  • Here’s the code
  • I was expecting X to happen
  • Y happened instead
  • Specific description of the key difference between X and Y that is bothersome

Properly answering this question is going to need more information about the scoping and lifecycle of this PID variable. Can it change? If so, when? Are structural directives like *ngFor in play here, where you are wanting the value of PID to attach to some other object?