Dynamic content in Angular 2
Denys Vuika
197

//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.

Show your support

Clapping shows how much you appreciated vishwajeet mane’s story.