Is not a function

Hi, i am very new to ionic and im using ionic framework to build a mobile apps. So ive been using codes from internet for my project. In my apps there are buttons to be connected. At first when i tested the code, it was good & the pages were connected. But when i am tried to reload bcs i made changes to the html page, theres error-----YourFancyButton is not a function. Ive been trying many times and the result is still the same. So this is the code for my button:

--------------------------------------------------(fun.html)-------------------------------------

       <ion-col>
            <button ion-button (click)="YourFancyButton()" large round color="secondary" class="button-full" style="height:90px; width:320px" icon-start> 
            <ion-icon large name="bulb"></ion-icon> Funfacts </button></ion-col>

----------------------------------------(fun.ts)------------------------------------------

 import { Component } from '@angular/core';
 import { NavController } from 'ionic-angular';
 import { FunfactsPage } from '../funfacts/funfacts';
 
 @Component({
    templateUrl:'fun.html'
 })
 
 export class FunPage {
   constructor(public navController: NavController) {
   }
 
   YourFancyButton(){
     this.navController.setRoot(FunfactsPage);
     }
 }

This button in FunPage is going to be connected to FunfactsPage. Btw, to test the app i type ionic serve and tested it by using devApp through mobile phone. Pls help me, this project is for my internship for a company :frowning: Thanks in advance!

Hello,

I see no typo. In this case try: Delete content of www folder and .sourcemaps folder. Clear cache of browser. Build with ionic serve again.

Maybe it helps.

Best regards, anna-liebt

1 Like

Hi,

Thank you for your replies :slight_smile: