分页控件不是离子4中的已知元素

时间:2019-08-21 09:52:02

标签: javascript angular ionic4

我遵循此页面(https://www.npmjs.com/package/ngx-pagination)的命令在我的ionic4应用中进行分页。但是我遇到了此错误。我认为ngx-pagination软件包尚未成功安装。是否有其他解决方案?

     Error : 
     ERROR Error: Uncaught (in promise): Error: Template parse errors:
'pagination-controls' is not a known element:
1. If 'pagination-controls' is an Angular component, then verify that it is part of this module.
2. If 'pagination-controls' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<pagination-controls (pageChange)="p = $event"></pagination-controls>
"): ng:///LoginPageModule/MenuPage.html@116:27
Error: Template parse errors:
'pagination-controls' is not a known element:
1. If 'pagination-controls' is an Angular component, then verify that it is part of this module.
2. If 'pagination-controls' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
 [ERROR ->]<pagination-controls (pageChange)="p = $event"></pagination-controls>

这是我的代码: app.module.ts:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import {HttpClientModule} from '@angular/common/http';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {IonicStorageModule} from '@ionic/storage';
import {FormsModule} from '@angular/forms';
import {IonicSelectableModule} from 'ionic-selectable';
import {NgxPaginationModule} from 'ngx-pagination';


import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import {EditCustomerPage} from './pages/edit-customer/edit-customer.page';


// import {MenuPage} from './pages/menu/menu.page';


@NgModule({
  declarations: [AppComponent, EditCustomerPage],
  entryComponents: [EditCustomerPage],
  imports: [ BrowserModule, IonicModule.forRoot(),
    AppRoutingModule,
    HttpClientModule,
    IonicStorageModule.forRoot(),
    FormsModule,
    NgxPaginationModule,
    IonicSelectableModule,

    ],
  providers: [
    StatusBar,
    SplashScreen,

    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent],

})
export class AppModule {}

menue.page.html

<pagination-controls (pageChange)="p = $event"></pagination-controls>

0 个答案:

没有答案