使用amDateFormat管道进行Ionic 3延迟加载

Ric*_*ard 4 ionic-framework ionic2 ionic3 angular

我正在使用Ionic3,并且正在转换为Lazy Loading以提高启动性能.

将我转换ChatsPage为延迟加载后,我遇到管道问题.正如你在下面看到的那样,它抱怨在我的使用中使用以下行chats.html.

    <h3 class="chat-time">{{item.timestamp | amDateFormat: 'D MMM YYYY'}}</h3>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)

知道如何处理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
Run Code Online (Sandbox Code Playgroud)

Sur*_*Rao 5

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

import {MomentModule} from 'angular2-moment';

@NgModule({
  imports: [
    MomentModule
  ],
Run Code Online (Sandbox Code Playgroud)