Dynamic content in Angular
Denys Vuika
1.1K16

//home.ts
add() {
this.cakename = document.getElementById("demo").innerText;
console.log(this.cakename);
}

//home.html
<p id = "demo" > {{cakeMenu.caken}} </p>
<button id="page-button1" ion-button color="calm" block small
style="font-weight:600;" (click)="add()">

I want the data from json to be stored into variable into my .ts file.the console shows blank option.please help.

Like what you read? Give vishwajeet mane a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.