Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Getting a variable from a .ts file into Ionic Creator project

$
0
0

@TeamTreeHuggers wrote:

I have created an Ionic Creator project, and exported it as a zip file. All of my html files are in a project/www/templates directory. Now I want to get code from my .ts files into the html templates. I have made a components folder in the src directory where I currently have the .ts file, and imported my file in both the app.module.ts file and the app.components.ts files.

In my .ts all I’m trying to do is get a variable into the html. My .ts looks like this:

export class leaderboard2
{
public testuser:string;
constructor(){
this.testuser = ‘test’;
}
}

And in my html I want to put it into an ion-item, so I have:

{{testuser}}

But when I do the ionic serve on my command line it still doesn’t show up in the html. Am I doing this wrong?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>