Within my component.ts file, I have developed a function:
getData(id) {
const idMod = id
const idModN = document.getElementById("idMod").innerHTML = idMod
console.log (idModN)
}
My goal is to click on a button and have the id of each element from the JSON inserted. Ideally, the code would look like this:
<button(click)="getData({{ forecast.id }})">Test</button>
Unfortunately, when I attempted to use {{ forecast.id }} within the brackets, it resulted in an error. Oddly enough, manually inputting a number worked flawlessly. How can I modify the code to accept {{ forecast.id }}? I have multiple ids that I need to fetch using a for loop.