<div>{{2018-04-16T05:56:45.200Z | amTimeAgo}}</div>上面给出了我作为1 minutes ago一分钟后的结果,但我想要的结果是1 mins ago,我如何使用angular2-moment npm模块来实现这一点?
我只能使用这个模块来完成here提供的result.The链接
发布于 2018-04-16 14:38:33
在阅读code of the pipe之后,您可以看到它调用了moment构造函数和from()方法,就像moment documentation中描述的那样。
在进一步研究如何设置使用的字符串之后,我找到了这个configuration object in the documentation。有了这个知识,我尝试find something设置这个属性,将我带到这个open issue。所以在interims中似乎有你可以(也许)使用的解决方案。也已经有了try to solve this problem。
但它似乎需要某种打磨(将位置参数移动到对象属性)。也许你可以接受这份工作并改进代码?
https://stackoverflow.com/questions/49850660
复制相似问题