[英]How can I create an underline filter with AngularJS?
I'm trying to make a filter so I can underline a specific expression but i don't really know how to change a CSS value of only an expression and not the entire tag. 我试图做一个过滤器,以便可以在特定的表达式下划线,但是我真的不知道如何更改仅表达式而不是整个标记的CSS值。 Or if there is a better way to achieve this, so I don't have to manually create tags for the specific parts that I want to underline.
或者,如果有更好的方法可以实现此目的,那么我不必为要强调的特定部分手动创建标签。
maybe something like this? 也许像这样? jsfiddle
jsfiddle
<div ng-app='App'>
<div ng-controller="MyCtrl">
<span ng-bind-html-unsafe="1000000 | wrap"></span>
</div>
</div>
var app = angular.module('App',[]);
app.filter('wrap', function () {
return function (text) {
var t = '<u>'+text+'</u>';
return t;
};
});
function MyCtrl($scope) { }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.