How do i display it on screen?

Hello, I’d really appreciate it if someone helped me with this please
I think the code is correct but I can’t seem to display it on screen
This is my code:
ts:

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {who_am_iPage } from '../who am i/who am i';
@Component({
 selector: 'page-tell_us_more',
templateUrl: 'tell us more.html'
})
export class tell_us_morePage {

generate: () => void;

constructor(public navCtrl: NavController, public navParams: NavParams) { }

openwhoami() {
    this.navCtrl.push(who_am_iPage);
}

randnumb() {
    
        function getRandomInt(min, max) {
            return Math.floor(Math.random() * (max - min + 1)) + min;
        }

        this.generate= function () {
            this.number = getRandomInt(1000, 9999);
        }

        this.generate();
    }


ionViewDidLoad() {
    console.log('ionViewDidLoad tell_us_morePage');
}
}

and this is my HTML:

  <ion-item>
          <button ion-button large color="light" style="text-transform: capitalize" 
click="generate()">Generate PIN</button>
           </ion-item>
      <div align="center" ng-if="counter">
        <h1>PIN:{{number}}</h1>
      </div>
          <p>use the PIN for important changes later</p>

Thank you for your Help!

Why are you defining this.generate inside of randnumb?

Anyway,

You’ll probably want to change things around to be like:

public number = 0;

private getRandomInt(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

private generate() {
  this.number = getRandomInt(1000, 9999);
}

Thank you for replying ! I tried what you told me to do but it didn’t work. My PIN:0 it didn’t give me a random number.

Sorry, this:
this.number = getRandomInt(1000, 9999);

Should be:
this.number = this.getRandomInt(1000, 9999);

Is it not throwing linting errors for you?

Oh, yes sorry i forgot to mention i noticed it and fixed it ! and still same thing

Oh ok, good. I was concerned and confused for a moment there.

Oh, in your template
click="generate()"
should be:
(click)="generate()"

YES, Thank you so much, it worked .