ano*_*ran 2 javascript kendo-ui angularjs
这是我在Kendo UI中的热图的代码.
<div ng-repeat="h in row.hours" ng-style="h.styleStr"
data-value="{{params.compare ? h.percentChange : h.current[unit]}}"
data-time="{{$index}}">
{{params.compare ? h.percentChange : h.current[unit]}}
</div>
Run Code Online (Sandbox Code Playgroud)
它的工作完美.什么h.current[unit]在div里面,确实是,它显示的值(十进制).像这样..
但是我需要将十进制值显示为整数.像这样...
我有一个intFormat功能就是这样.例如:
intFormat(79.952)将返回80.所以我试图使用intFormat函数格式化热图中的数字.怎么做到这一点?我不知道这是否合法,但我尝试过{{params.compare ? h.percentChange : intFormat(h.current[unit])}},但它不起作用.我正在使用Angularjs 1X和KendoUI.我可以在双花括号内使用功能吗?
小智 6
你当然可以:
创建一个这样的函数
$scope.getDisplayValue = function(currentValue)
{
return intFormat(currentValue);
}
Run Code Online (Sandbox Code Playgroud)
然后在html中像这样引用它:
{{getDisplayValue(h.percentChange)}}
Run Code Online (Sandbox Code Playgroud)
请让我知道,如果你有任何问题.
| 归档时间: |
|
| 查看次数: |
6754 次 |
| 最近记录: |