Ionic 3 Lazy amDateFormat handset download

I am using Ionic3, and I am switching to Lazy Loading to improve launch performance.

I had a problem with pipes after converting mine ChatsPageto lazy loading. As you can see below, he complains about using the next line in mine 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>

Question

Any idea how to handle amDateFormat(angular2 -moment) with lazy loading?

Additional Information:

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
+4
source share
1 answer

For lazy loading, you need to add the module to the page.module.ts import .

import {MomentModule} from 'angular2-moment';

@NgModule({
  imports: [
    MomentModule
  ],
+5
source

Source: https://habr.com/ru/post/1676333/


All Articles