我正在使用Linky使我的ng绑定包括链接参考。但是,有时我的用户会转储具有超长URL的链接,这些链接通常比包含它们的div更宽。我想做一些像"http://Some.ReallyLong.com/URL/Thats/Way/Too/Long/For/The/Div/That/Should/Contain/it/called/SomeFile.jpg“到"http://Some.Really.com/.../SomeFile.jpg”这样的事情。
最好的方法是什么?有没有办法在Linky上面运行一些文本过滤器?
现在我有
<p ng-bind-html="comment.Body | linky"></p>
发布于 2017-05-01 17:11:00
所以你可以用链式过滤器
<p ng-bind-html="comment.Body | linky | customfilter"></p>
你很可能不得不做一些正则魔法来获得你想要的过滤。下面的文章将是从域方面开始的一个良好开端。
How to shorten url to show domain only with angular.js filter
https://stackoverflow.com/questions/43723096
复制相似问题