3
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {Dashboard} from '../dashboard/dashboard'
import {EventPlan} from '../event-plan/event-plan'
import {EmployeeList} from '../../providers/employee-list'
import {GoalActionDashboard} from '../../providers/goal-action-dashboard'

@IonicPage()
@Component({
  selector: 'page-service-requirement-form',
  templateUrl: 'service-requirement-form.html',
})
export class ServiceRequirementForm {
  eventPlan() {
    this.navCtrl.setRoot(EventPlan);
  }
}

Here I want to go to another page o'clock button. In my html-page, I have a button where I declared a function named eventPlan(). But this is not working. It throws the following error:

No component factory found. Did you add it to @NgModule.entryComponents

How can I fix this error?

georg-un
  • 1,123
  • 13
  • 24
omkara
  • 974
  • 5
  • 24
  • 50
  • Possible duplicate of [What is entryComponents in angular ngModule?](https://stackoverflow.com/questions/39756192/what-is-entrycomponents-in-angular-ngmodule) – core114 Dec 13 '17 at 09:16

1 Answers1

4

It seems like you haven't imported you iconic-framework module in APP.Module.ts file. Whenever you use it outside the module, you need to import it in your module file.

import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { Ng2CompleterModule } from "ng2-completer";

@NgModule({
  declarations: [component],
  imports: [
    NgbModule.forRoot(),
    FormsModule,
    BrowserModule,
    Ng2SmartTableModule,
    Ng2CompleterModule
  ],
  providers: [ReportService],
  bootstrap: [AppComponent],
  exports:[]
})
export class AppModule { }

In the code above I used three outside module NgbModule, Ng2SmartTableModule, Ng2CompleterModule which I imported in my app.module.ts file so I can get access to them without any error.

Import your module in @NgModule metadata.

georg-un
  • 1,123
  • 13
  • 24
Pranay Rana
  • 175,020
  • 35
  • 237
  • 263