Hey guys I have a problem which I hope you guys can help me out. I have a variable in my .ts file and I need to bring it over to my html file. Do you guys know how? Thanks!
export class HomePage {
static myid: any;
constructor(private platform: Platform) {
HomePage.myid = 1000; <-- I need to bring this variable to my html file
}
}
export class HomePage {
public homePage : number = null;
constructor(private platform: Platform) {
this.homePage = 1000; <-- I need to bring this variable to my html file
}
}
.html file
<ion-content>
{{homePage}}
</ion-content>
I strongly recommend you to read some tutorials about ionic 2. Josh Morony have some good ones.
homePage and myid are both bad names. I realize people are often simplifying things for posting purposes, but in actual code it is vital to give properties names that describe to an uninformed reader what the propertyâs purpose is. This will make your code self-documenting and maintainable.
Also, the property in OP is static, which wonât work. Templates can only bind to ordinary object properties.