尝试从一个页面推送到另一个页面时,我收到错误.当我尝试推到同一页面时,它不会给出错误.只有在从一个页面推送到另一个页面时,我会收到错误. ‘setRoot()’也没有给出错误.
this.navCtrl.push( Page7 );
我已经将第7页添加到app.module.ts.
import { NgModule } from '@angular/core'; import { IonicApp,IonicModule } from 'ionic-angular'; import { MyApp } from './app.component'; import { Page1 } from '../pages/page1/page1'; import { Page2 } from '../pages/page2/page2'; import { Page3 } from '../pages/page3/page3'; import { Page4 } from '../pages/page4/page4'; import { Page5 } from '../pages/page5/page5'; import { Page6 } from '../pages/page6/page6'; import { Page7 } from '../pages/page7/page7'; @NgModule({ declarations: [ MyApp,Page1,Page2,Page3,Page4,Page5,Page6,Page7 ],imports: [ IonicModule.forRoot(MyApp) ],bootstrap: [IonicApp],entryComponents: [ MyApp,providers: [] }) export class AppModule {}
这是一个离子2应用程序.它给出这个错误.
EXCEPTION: Error in ./Page6 class Page6 - inline template:21:56 caused by: No component factory found for Page7
我喜欢解决方案您必须将要推入的页面添加到父目录中.也应该也包含在@NgModule中.
原文链接:https://www.f2er.com/angularjs/142932.htmlimport {ApiServices} from '../../providers/api-services'; import { Visualizer } from '../Page7/Page7'; @Component({ selector: 'page-page6',templateUrl: 'page6.html',providers: [ ApiServices ],entryComponents:[ Page7 ] }) export class Page6 { tapped(event,id ) { this.navCtrl.push( Page7,{ id: id }); } }