妙音 posted @ 2014年8月22日 21:13 in webui with tags angularjs;过滤器;number , 7545 阅读


{{ number_expression | number : fractionSize}}


$filter('number')(number, fractionSize)


  • number 待精确的数字
  • factionSize(可选) 小数点后精确位数,默认值是3.
默认情况下保留的小数位数小于等于3. 比如: 1234-->1234;1234.56789-->1234.568;1234.56-->1234.56)


<!doctype html>
<html ng-app='demo'>
<meta charset='utf-8'>
<div ng-controller="ExampleController">
  输入数字: <input ng-model='val'><br>
  <!-- 默认格式 -->
  默认格式: <span id='number-default'>{{val | number}}</span><br>
  <!-- factionSize=0 -->
  保留0位: <span>{{val | number:0}}</span><br>
  <!--factionSize大于小数点位数 -->
  保留10位: <span>{{val | number:10}}</span><br>
  <!-- factionSize小于小数点位数-->
  保留2位: <span>{{val | number:2}}</span>

<script src="/static/lib/angular/angular.js"></script>
<script src="/static/lib/angular-resource/angular-resource.min.js"></script>
    var app = angular.module('demo', ['ngResource'])
    .controller('ExampleController', function($scope) {
        $scope.val = 1234.56789;
输入数字: 1,234.56789
默认格式: 1,234.568
保留0位: 1,235
保留10位: 1,234.5678900000
保留2位: 1,234.57
research paper write 说:
2022年3月07日 18:54

A number of dissertation websites on the internet online in the event you obtain clearly declared in the website.

ac repair Davie 说:
2022年6月01日 13:57

Broward County AC repair: Parkland, Pompano Beach, Deerfield Beach, Fort Lauderdale & Davie. Satisfaction guaranteed - call Amtek now (855) 585-0219.

office chairs tampa 说:
2022年6月01日 18:24

In today’s rapidly changing office environments, Office Furniture Solutions is uniquely positioned to assist large corporations, small business owners, and homeowners with a broad range of office furniture products that ensure safety while meeting the latest design trends.

societies in islamab 说:
2022年6月01日 20:19

The dream of owning a home is very common but some people achieve their dream by taking the right step at the right time. There are many investment opportunities that are offering the best and affordable housing societies in Islamabad in installments.

humana medicare par 说:
2022年6月01日 21:17

If you’ve been researching Humana Medicare Plans and have found one plan that caught your eye, its likely Humana Medicare Part D. Humana Part D plans are by far some of the most popular in the marketplace for stand-alone coverage and have held that place for some time now. With a Humana Part D Insurance policy, the benefits you receive are plentiful while still managing a low and affordable premium monthly.

innovation transform 说:
2022年6月09日 19:07

Extend the potentials of your technology at STP Platform, where scientific theories and technological development goes beyond physical limitations. Demonstrate the power of your technology in living scenarios. We strive to bridge industry-leading corporates and tech startups amongst our community, unlocking every technology adoption possibility.

家居消毒 说:
2022年6月11日 17:42

第五波疫情肆虐下,大部分人又再展開Work From Home、網課生活,教一眾小市民加倍關注日常家居清潔衛生,以確保家人、小朋友及毛孩健康。除了日常勤洗手、酒精搓手、頻繁更換潔淨衣物及拖地消毒外,亦可以考慮為家居添置最新消毒儀器,幫助室內環境潔淨細菌與病毒。通過嚴格安全檢測、對人體無害的Lumenizer™ 300過濾遠紫外消毒儀,可謂家居潔淨好幫手,能夠全天候快速高效殺菌消毒,締造一個舒適無菌無毒的家園。

登录 *

loading captcha image...
or Ctrl+Enter