Ionic check number

Hi, i’m new to ionic and trying to validate if a user has entered the correct number. I have structured it in a form. They are asked to remember a number, if it is correct they should be shown a message to say if its correct or not.
Ive followed a tutorial video to get this far but Im unable to check if its a number as the tutorial checked it the field was empty.
thanks in advance.



  	 <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
  		<ion-title>Memory Test</ion-title>


<ion-content padding>

  <button ion-button (click)="NumberTechniques()">Memory Techniques</button>
<p> Are you able to remember phone numbers?</p> 
 <p>Try to memorise the following number:</p>

<button ion-button (click)="show_input()" >Show/Hide number</button>
<div *ngIf="show">
 <h5> 19161945</h5>

		<p> Enter the phone number you memorised:</p>


<form [formGroup]="formgroup">
      <ion-label floating>
        First Number
      <ion-input type="text" formControlName="memnumber" ></ion-input>

    <ion-item *ngIf="memnumber != '19161945'" >
    <p>Number is correct</p>
  <button  clear ion-button>Check</button>



import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Answer } from "../../models/answer";
import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms';
import { Test1Page } from '../test1/test1';

  selector: 'page-test',
  templateUrl: 'test.html',
export class TestPage {
	answer = {} as Answer;

  constructor(public navCtrl: NavController, public navParams: NavParams, public formbuilder:FormBuilder) {

    this.formgroup ={
      memnumber:[ '',Validators.required],
      phonenumber:[ '',Validators.required]

    this.memnumber = this.formgroup.controls['memnumber'];
    this.phonenumber = this.formgroup.controls['phonenumber'];

show_input() {
  // = true;
if( == true){ = false;
  { = true;

show_input1() {
  // = true;
if(this.show1 == true){
  this.show1 = false;
  this.show1 = true;

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


I do something similar in my app. But I don’t use html forms. I do something like this.

For the input,

<ion-input placeholder="Enter name" [(ngModel)]="enteredName"></ion-input>
<button ion-button (click)="check()">Check</button>

and in the class,

    if(enteredName === 'secret word'){
    else {

first check memnumber what it returns number or string with the help of console.log(typeof memnumber). In template driven when we use ngModel it always return in string whether you type number or string so i had to use regex pattern in order to validate the user input value.

That sounds like total overkill, and one of the relatively rare cases where the JavaScript == operator is actually useful:

$ node
> 7 == '7';

Indeed but it is not working in this condition
how would you check ?

 if(typeof this.test == 'number') {

stackbltiz example: stackblitz