angular.js - 包装在跨度货币符号和小数小数、跨度、装在、货币

由网友(づ羞蘤之容╄→)分享简介:你都不可能做这样的事情的角度?Can you possibly do something like this in angular?这不是很可能做到这一点,因为不分析标记或东西。It's not quite possible to do this, as doesn't parse tags or somethin...

你都不可能做这样的事情的角度?

Can you possibly do something like this in angular?

这不是很可能做到这一点,因为不分析标记或东西。

It's not quite possible to do this, as doesn't parse tags or something

{{10000 |货币:<跨度> $< / SPAN>中}}

http://plnkr.co/edit/WluYoe2Ltmhmhvr8BBWX?p=$p$pview

更何况不知何故单独的十进制数。

let alone somehow separate decimal number..

理想的结果将是

1 000 000<跨度类=DEC> 00< / SPAN><跨度类=恶狗>€< / SPAN>

这不是真的有可能与任何过滤器设置做的是它..?

It's not really possible to do with any filter settings is it..?

我可以尝试和修改角的货币滤波器和 formatNumber 的功能,但它仍然把它作为一个文本,而不是一个span元素。

I could try and modify angular's currency filter and the formatNumber function, but it still would take it as a text rather than a span element.

//编辑你能真正做到这一点http://plnkr.co/edit/dcEhHi8sp43564ZvC4D1?p=$p$pview

< p NG绑定HTML的不安全=10000 |货币:'<跨度> $< / SPAN>'>< / P>

仍茫然不知小数虽然

推荐答案

它实际上可能做到这一点。

It's actually possible to do this

< p NG绑定HTML的不安全=10000 |货币:'<跨度> $< / SPAN>'>< / P>

或将其套在这样的本国货币过滤器

or wrap it around the native currency filter like this

app.filter('currencys', ['$filter', '$locale', 
    function($filter, $locale) {
        return function (num) {
            var sym = $locale.NUMBER_FORMATS.CURRENCY_SYM;
            return $filter('currency')(num, '<span>'+ sym +'</span>');
        };
    }
]);

,然后使用它像这样

and then use it like this

&LT;跨度NG绑定HTML的不安全=10000 | currencys&GT;&LT; / SPAN&GT;

阅读全文

相关推荐

最新文章