Angular 2 “time ago” pipe

前端 未结 8 1420
余生分开走
余生分开走 2020-12-08 04:56

I am trying to create a \'time ago\' pipe for my Angular 2 application.

It should transform a date to a string such as \'5 minutes ago\' or \'60 seconds ago\'. It wo

相关标签:
8条回答
  • 2020-12-08 05:18

    Use ngx-moment https://github.com/urish/ngx-moment, a pipe integration with Momentjs, with i18n support

    0 讨论(0)
  • 2020-12-08 05:23

    Get Time-Ago in AngularJs2

    You need to run this command npm install time-ago-pipe --save to install the time-ago npm package package in your angular application ex : PS D:\D\TimeAgo> npm install time-ago-pipe --save. After run this command the package will added. Image shows how to add import {TimeAgoPipe} from 'time-ago-pipe'; in app.module and put TimeAgoPipe in Declarations[Pass input from componento/p

    0 讨论(0)
提交回复
热议问题