无法在过滤器中插入HTML代码? [英] unable to insert html code inside filter?

查看:110
本文介绍了无法在过滤器中插入HTML代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angualr JS code:

  $ scope.rupee = $ filter('currency') ($ scope.dols * 67.33,'INR',3); 

我试图在此过滤器中插入html代码。这不是'INR',我希望获得符号。请帮我解决这个问题。问题是没有获得通过过滤器。而不是'INR',我想使用&#8377,但它没有按照我的预期呈现。

 < div> {{rupee}}< / div> 


解决方案

b

  $ scope.rupee = $ filter('currency')($ scope.dols * 67.33,'\\\₹',3); 






当您问到我们可以编写HTML代码里面的symbolFormat参数?
答案如下:




它接受一个字符串参数,因此无论您提供什么字符串,它都将用作货币符号



作为参考,您可以在这里查看


Angualr JS code:

$scope.rupee = $filter('currency')($scope.dols * 67.33, 'INR', 3);

I am trying to insert html code inside this filter. That is instead of 'INR', I wish to get ₹ symbol. Please help me to solve this. And the problem is not getting the ₹ through filter. Instead of 'INR', I want to use &#8377 but it's not rendering as I expected.

html code:

<div>{{rupee}}</div>

解决方案

Modify your statement to

$scope.rupee = $filter('currency')($scope.dols * 67.33, '\u20B9', 3);


As you asked, "Can we write HTML code inside symbolFormat parameter?" Answer will be below:

It takes a string parameter, so whatever string you are providing, it will be used to apply as currency symbol

For reference you can check Here

这篇关于无法在过滤器中插入HTML代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆