Ionic 2 and using <script>

My question is I want to create my own method to increment a number using a script tag. Everything online is telling me some old information that doesn’t apply to the newer versions of Ionic. This is my code:
`

<button type="button" onClick="onClick()">Click me</button>
<p>Clicks: <a id="clicks">0</a></p>

`

Every time I click “Click me” I get a runtime error: onClick() is not defined. Please help.
Note there is no js folder, no app.js. Kind of new to Ionic so this solution could be very simple.

Why don’t you just do it in Ionic and Angular? Then you don’t need <script> and won’t have this problem.

<button (click)="clicked()">click me</button>
<p>Clicks: {{clicks}}</p>
clicks: number;
clicked(): void {
  ++this.clicks;
}
1 Like

It almost worked…when I click the button it says NaN instead of the number.
Jk… just edited to say
clicks: number=0;

THANKS!!