Use jQuery timeago or momentjs and AngularJS together

前端 未结 4 1705
迷失自我
迷失自我 2020-12-23 12:48

I want to use timeago plugin to make dates look nicer. The problem is that these dates are fetched via AngularJS from the REST dynamically. So, when I attach this jQuery plu

4条回答
  •  猫巷女王i
    2020-12-23 13:47

    You can use the am-time-ago directive from angular-moment module (which is based on Moment.js).

    It does not require jQuery, and the time get updated as time progresses. Example:

    
    

    The content of the above span will be replaced with a relative time string, for example "2 hours ago", and will be automatically updated as time progresses.

提交回复
热议问题