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:

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';
import {who_am_iPage } from '../who am i/who am i';
 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() {

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

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


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

and this is my HTML:

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

Thank you for your Help!

Why are you defining this.generate inside of randnumb?


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
should be:

YES, Thank you so much, it worked .