将指令延迟加载到页面 IONIC 3 中的组件中

Lazy load a directive into a component in a page IONIC 3

我有一个使用组件的页面,我在该组件的模板中调用了一个指令。我已将该指令导入到添加到 page.module 设置的共享模块中。但是该指令未在组件上注册。我怎样才能让它工作。

页面 -> 组件 -> 指令

共享模块:

import { NgModule } from '@angular/core';
/** Directives **/
import { CallDirective } from '../directives/call/call';
import { NavigateDirective } from '../directives/navigate/navigate';
import { OpenLinkDirective } from '../directives/open-link/open-link';
import { ShareDirective } from '../directives/share/share';
import {UserBookingsDirective} from '../directives/user-bookings/user-bookings'
import {BookingCommentDirective} from '../directives/booking-comment/booking-comment'
/** Pipes **/
import { LimitToPipe } from './../pipes/limit-to/limit-to';
import { SearchPipe } from './../pipes/search/search';
@NgModule({
  declarations: [
  CallDirective,
    NavigateDirective,
    OpenLinkDirective,
    ShareDirective,
    UserBookingsDirective,
    BookingCommentDirective,
    LimitToPipe,
    SearchPipe
  ],
  exports:[
      CallDirective,
    NavigateDirective,
    OpenLinkDirective,
    ShareDirective,
    UserBookingsDirective,
    LimitToPipe,
    SearchPipe
  ],
  imports: [

  ],
})
export class SharedModule {}

页面模块:

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { BookingsPage } from './bookings';
import { MomentModule } from 'angular2-moment';
import {SharedModule} from '../../app/shared.module';
/** Components **/
import {BookingItemComponent} from '../../components/booking-item/booking-item'
@NgModule({
  declarations: [
    BookingsPage,
    BookingItemComponent
  ],
  imports: [
    IonicPageModule.forChild(BookingsPage),
    MomentModule,
    SharedModule
  ],
})
export class BookingsPageModule {}

BookingCommentDirective 添加到 exports: [...],使其可用于导入模块:

@NgModule({
  declarations: [
  CallDirective,
    NavigateDirective,
    OpenLinkDirective,
    ShareDirective,
    UserBookingsDirective,
    BookingCommentDirective,
    LimitToPipe,
    SearchPipe
  ],
  exports:[
    BookingCommentDirective, // <<== added
    CallDirective,
    NavigateDirective,
    OpenLinkDirective,
    ShareDirective,
    UserBookingsDirective,
    LimitToPipe,
    SearchPipe
  ],
  imports: [

  ],
})
export class SharedModule {}