使用amDateFormat管道进行Ionic 3延迟加载 [英] Ionic 3 Lazy Loading with amDateFormat pipe

查看:354
本文介绍了使用amDateFormat管道进行Ionic 3延迟加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am using Ionic3, and am in the process of converting to Lazy Loading in order to improve startup performance.

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

I am experiencing a problem with pipes after converting my ChatsPage to lazy loading. As you can see below, it is complaining about the use of the following line in my 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)延迟加载?

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

更多信息:

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 <的导入中/ strong>。

For lazy loading you need to add the module to imports of the page.module.ts.

import {MomentModule} from 'angular2-moment';

@NgModule({
  imports: [
    MomentModule
  ],

这篇关于使用amDateFormat管道进行Ionic 3延迟加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆