Ionic Beta: Как определить ion-tabs с отдельным компонентом? - PullRequest
0 голосов
/ 03 января 2019

Я использую Angular JS (7.1.4) с платформой beta Ionic (5.0.0-beta.21).

У меня есть две вкладки: Главная и История в пользовательском интерфейсе.Из документации по ионным вкладкам я добавил RechargeComponent и RechargeHistoryComponent соответственно.

    //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>

Я импортировал оба компонента в home.component.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
  ]
})

Я также объявил об этом в app.module.ts.

import { RechargeHistoryComponent } from './recharge-history/recharge-history.component';
import { RechargeComponent } from './recharge/recharge.component';

@NgModule({
  declarations: [
    AppComponent,
    RechargeHistoryComponent,
    RechargeComponent

UI

В консоли выдается ошибка:

core.js: 14597 Ошибка: не задана (в обещании):Ошибка: не найдена фабрика компонентов для RechargeComponent.Вы добавили его в @ NgModule.entryComponents?Ошибка: не найдена фабрика компонентов для RechargeComponent.Вы добавили его в @ NgModule.entryComponents?at noComponentFactoryError

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...