_co.gotoArchivePage is not a function
_co.gotoArchivePage is not a function
I am quite new to ionic and I am trying to develop a todo application in ionic version 3.9. I tried creating a fab button which would lead me to a “ArchiveTodos” Page, but each time I click on the fab button I get this result:
Error
Runtime Error
co.gotoArchivePage is not a function
Stack
TypeError: _co.gotoArchivePage is not a function
at Object.eval [as handleEvent]
(ng:///AppModule/HomePage.ngfactory.js:152:31)
at handleEvent (http://localhost:8100/build/vendor.js:13963:155)
at callWithDebugContext (http://localhost:8100/build/vendor.js:15472:42)
at Object.debugHandleEvent [as handleEvent]
(http://localhost:8100/build/vendor.js:15059:12)...
Environment:
Ionic Framework: 3.9.2
Ionic App Scripts: 3.1.11
Angular Core: 5.2.11
Angular Compiler CLI: 5.2.11
Node: 8.9.3
OS Platform: Windows 10
Navigator Platform: Win32
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/68... Safari/537.36
home.ts:
import Component from ‘@angular/core’;
import NavController, AlertController, reorderArray from ‘ionic-
angular’;
import TodoProvider from “…/…/providers/todo/todo”;
import ArchivedTodosPage from “…/archived-todos/archived-todos”;
@Component(
selector: ‘page-home’,
templateUrl: ‘home.html’
)
export class HomePage
public todos = ;
public reorderIsEnabled = false;
constructor(private todoProvider: TodoProvider, public navCtrl:
NavController, private alertController : AlertController, public
archivedtodosPage : ArchivedTodosPage)
this.todos = this.todoProvider.getTodos();
goToArchivePage()
this.navCtrl.push(ArchivedTodosPage);
toggleReorder()
this.reorderIsEnabled = !this.reorderIsEnabled;
itemReordered($event)
reorderArray(this.todos, $event);
openTodoAlert()
let addTodoAlert = this.alertController.create(
title: “Add A Todo”,
message: “Enter your Todo”,
inputs: [
type: “text”,
name: “addTodoInput”
],
buttons: [
text: “Cancel”
,
text: “Add Todo”,
handler: (inputData)=>
let todoText;
todoText = inputData.addTodoInput;
this.todoProvider.addTodo(todoText);
]
);
addTodoAlert.present();
home.html:
the Real Todo Edit Done
</ion-icon>
</button>
</ion-buttons>
todo
</ion-icon>
</button>
</ion-item-options>
</ion-item-sliding>
</ion-list>
<button ion-fab (click)="gotoArchivePage()">
<ion-icon name="archive">
</ion-icon>
</button>
app.module.ts:
import BrowserModule from ‘@angular/platform-browser’;
import ErrorHandler, NgModule from ‘@angular/core’;
import IonicApp, IonicErrorHandler, IonicModule from ‘ionic-angular’;
import SplashScreen from ‘@ionic-native/splash-screen’;
import StatusBar from ‘@ionic-native/status-bar’;
import MyApp from ‘./app.component’;
import HomePage from ‘…/pages/home/home’;
import TodoProvider from “…/providers/todo/todo”;
import HttpClientModule from ‘@angular/common/http’;
import ArchivedTodosPage from “…/pages/archived-todos/archived-todos”;
@NgModule(
declarations: [
MyApp,
HomePage,
ArchivedTodosPage
],
imports: [
HttpClientModule,
BrowserModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
ArchivedTodosPage
],
providers: [
StatusBar,
SplashScreen,
provide: ErrorHandler, useClass: IonicErrorHandler,
TodoProvider
]
)
export class AppModule
app.component.ts CODE:
import Component from ‘@angular/core’;
import Platform from ‘ionic-angular’;
import StatusBar from ‘@ionic-native/status-bar’;
import SplashScreen from ‘@ionic-native/splash-screen’;
import ArchivedTodosPage from “…/pages/archived-todos/archived-todos”;
import HomePage from ‘…/pages/home/home’;
@Component(
templateUrl: ‘app.html’
)
export class MyApp
rootPage:any = HomePage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen:
SplashScreen)
platform.ready().then(() =>
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
statusBar.styleDefault();
splashScreen.hide();
);
I will be most grateful for your assistance as I have been struggling to get this issue fixed for quite sometime now
Thanks for having responded. All the same, it is not as you have stated, the code is way more than what i posted, i would not agree to you saying that I just dumped my code. I am not at the moment as you are, very conversant with coding. I am learning everyday, every single day. Please be more considerate and understanding with your language. Thank you :) . Nevertheless, more importantly I am sincerely grateful for your kind assistance.
– iclectic
Sep 2 at 16:15
I agree, there are people dumping worse stuff. But still: many parts of your js code are almost not at all indented. Therefore the input is way harder to read than necessary. Seriously: such details matter big time.
– GhostCat
Sep 2 at 16:21
Thank you. @GhostCat, are there like any websites or links to resources which can help me clean up my code as you suggested in case I have another question. Considering you are a guru at coding?
– iclectic
Sep 2 at 16:25
Most IDEs such as intellij or atom should have auto formatter features that also indent code in a meaningful way. That would be a good starting point. You then paste that into the edit window here. Maybe you have to select the code and click the braces icon. That will indent by 4 to display as code. You should also use the preview window to ensure you are happy with the results.
– GhostCat
Sep 2 at 17:55
Thanks for contributing an answer to Stack Overflow!
But avoid …
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
But avoid …
To learn more, see our tips on writing great answers.
Required, but never shown
Required, but never shown
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I did a bit of re-formatting of your input, and made the question more clear. But: this is way too much input. You should look into Minimal, Complete, and Verifiable example and rework your question to contain a minimal, complete example. Dont expect people dig through so many lines of code. Especially tiven the fact that you more or less just dumped your code here. You should at least spent the time required to decently indent your code snippets (so that blocks/loops/... are more indented).
– GhostCat
Sep 1 at 18:48