使用 amDateFormat 管道的 Ionic 3 延迟加载

Ionic 3 Lazy Loading with amDateFormat pipe

我正在使用 Ionic3,并且正在转换为延迟加载以提高启动性能。

将我的 ChatsPage 转换为延迟加载后,我遇到了管道问题。正如您在下面看到的,它抱怨在我的 chats.html.

中使用以下行
    <h3 class="chat-time">{{item.timestamp | amDateFormat: 'D MMM YYYY'}}</h3>
ERROR Error: Uncaught (in promise): Error: Template parse errors:
The pipe 'amDateFormat' could not be found ("item.memberId2 && !item.lastMsg_read2))}">{{item.lastMsg_text}}</p>
        <h3 class="chat-time">{{[ERROR ->]item.timestamp | amDateFormat: 'D MMM YYYY'}}</h3>
      </ion-item>

"): ng:///ChatsPageModule/ChatsPage.html@28:32
Error: Template parse errors:
The pipe 'amDateFormat' could not be found ("item.memberId2 && !item.lastMsg_read2))}">{{item.lastMsg_text}}</p>
        <h3 class="chat-time">{{[ERROR ->]item.timestamp | amDateFormat: 'D MMM YYYY'}}</h3>
      </ion-item>

问题

知道如何使用延迟加载处理 amDateFormat(angular2-moment)吗?

更多信息:

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: macOS Sierra
Node Version: v6.9.4
Xcode version: Xcode 8.3.2 Build version 8E2002

对于延迟加载,您需要将模块添加到 page.module.ts.

的导入中
import {MomentModule} from 'angular2-moment';

@NgModule({
  imports: [
    MomentModule
  ],