代码之家  ›  专栏  ›  技术社区  ›  Lizesh Shakya

离子测试版:如何定义离子标签与单独的组件?

  •  1
  • Lizesh Shakya  · 技术社区  · 7 年前

    我正在使用Angular JS(7.1.4)和beta-Ionic框架(5.0.0-beta.21)。

    我在UI中有两个选项卡:主页和历史记录。从 documentation of ionic tabs ,我分别添加了充电组件和充电历史组件。

        //in the home.component.html
    
    <ion-tabs>
            <ion-tab component="RechargeComponent" tab="home"></ion-tab>
            <ion-tab component="RechargeHistoryComponent" tab="history"></ion-tab>
    
            <ion-tab-bar slot="bottom">
                <ion-tab-button tab="home">
                    <ion-label>Home</ion-label>
                    <ion-icon name="home"></ion-icon>
                </ion-tab-button>
                <ion-tab-button tab="history">
                    <ion-label>History</ion-label>
                    <ion-icon name="bookmarks"></ion-icon>
                </ion-tab-button>
            </ion-tab-bar>
        </ion-tabs>
    

    我已经在国内进口了这两种组件。组成部分ts。

    import { RechargeComponent } from "../recharge/recharge.component";
    import { RechargeHistoryComponent } from "../recharge-history/recharge-history.component";
    
    @Component({
      selector: 'app-home',
      templateUrl: './home.component.html',
      styleUrls: ['./home.component.css'],
      entryComponents: [
        RechargeComponent, RechargeHistoryComponent
      ]
    })
    

    我已经在应用程序中声明了。单元我也是。

    import { RechargeHistoryComponent } from './recharge-history/recharge-history.component';
    import { RechargeComponent } from './recharge/recharge.component';
    
    @NgModule({
      declarations: [
        AppComponent,
        RechargeHistoryComponent,
        RechargeComponent
    

    UI

    在控制台中,它给出

    果心js:14597错误:未捕获(承诺中):错误:未找到组件的组件工厂。你把它添加到@NgModule了吗。入口组件? 错误:未找到组件的组件工厂。你把它添加到@NgModule了吗。入口组件? 无组件工厂错误

    0 回复  |  直到 7 年前
    推荐文章