angularjs指令名是怎么回事?
<img>加载图片失败,怎样替换为默认图片

angularjs过滤器(number)

妙音 posted @ 2014年8月22日 21:13 in webui with tags angularjs;过滤器;number , 8242 阅读
用来精确浮点数(指定小数点位数).

在html中用法

{{ number_expression | number : fractionSize}}

在js中用法

$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'>
<body>
<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>
</div>

<script src="/static/lib/angular/angular.js"></script>
<script src="/static/lib/angular-resource/angular-resource.min.js"></script>
<script>
    var app = angular.module('demo', ['ngResource'])
    .controller('ExampleController', function($scope) {
        $scope.val = 1234.56789;
    });
</script>
</body>
</html>
 
显示结果
输入数字: 1,234.56789
默认格式: 1,234.568
保留0位: 1,235
保留10位: 1,234.5678900000
保留2位: 1,234.57
 
Avatar_small
Imamia Quran Academy 说:
2023年8月12日 06:53

Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks. It is very difficult to find a good Shia Quran Center with Shia teachers abroad except in Muslim or especially Shia majority countries. Fortunately, Imamia Quran Academy has realized this need and has launched the Shia Online Quran Center.

Avatar_small
Car window tinting 说:
2023年9月04日 17:20

At AZ's Best Window Tinting, we believe that every home deserves the best window tinting solutions available on the market. Our philosophy is to provide our customers with high-quality and affordable residential window tinting services that enhance their home's comfort, privacy, and energy efficiency.

Avatar_small
煥活新肌 说:
2023年9月25日 19:23

Discover the best you with Nu Skin's innovative anti-aging skin care products and rewarding business opportunities, while making a difference in the world .

Avatar_small
intercomrepairny 说:
2023年11月08日 21:54

We helps you select the suitable with excellent style and reliability, In addition, We has more than 20 years of experience in Installs new or upgrade old intercom systems to new and modern video intercom system use exiting wires for residential apartment building. commercial buildings and office.

Avatar_small
omnippp 说:
2023年11月09日 13:37

Omni Painting, Plastering & Pressure Washing provides painting, plastering restoration, over 30 years of experience. Free Estimates. Fully Insured and bonded.

Avatar_small
一拍即寄 说:
2023年11月20日 16:01

Jiahong∙Global Self-purchasing brings together high-end technology and professional logistics knowledge to provide customers with one-stop global shipping solutions. You can enjoy online shopping in any store in the European and American markets. Jiahong∙Global Self-purchasing will provide you with fast, reliable, economical and affordable logistics services, and deliver the goods to you from self-operated warehouses in Europe, America and other places.

Avatar_small
omnippp 说:
2023年11月21日 22:47

Omni Painting, Plastering & Pressure Washing provides painting, plastering restoration, over 30 years of experience. Free Estimates. Fully Insured and bonded.

Avatar_small
intercomrepairny 说:
2023年11月22日 18:59

We helps you select the suitable with excellent style and reliability, In addition, We has more than 20 years of experience in Installs new or upgrade old intercom systems to new and modern video intercom system use exiting wires for residential apartment building. commercial buildings and office.

Avatar_small
Washington DC Tax At 说:
2023年11月22日 19:51

Charles A. Ray, Jr. - Your Trusted Tax Attorney in Washington, DC, Providing Tax Relief Solutions for Individuals and Businesses Nationwide.

Avatar_small
mygdkitchen 说:
2023年12月12日 13:49

Gestational diabetes can be scary, but My GD Kitchen is here to help. We provide helpful information and resources on everything from meal planning to exercise to blood sugar monitoring.

Avatar_small
Landscaping Construc 说:
2023年12月12日 20:35

Maintaining a lush, green lawn enhances the beauty of any outdoor space. Effective lawn care is not just a routine, but a commitment to creating a welcoming environment for relaxation and enjoyment.

Avatar_small
blackrabbyt.com 说:
2023年12月21日 21:05

Wir entwickeln, beleben und lassen dich wachsen und das darüber hinaus, indem wir deine Erfolgsgeschichte digital spürbar machen, deine einzigartige Solution finden und gewissenhaft deine gewünschte Aufmerksamkeit erzielen.

Avatar_small
car batteries Dubai 说:
2023年12月26日 14:20

Within our sizable garage, we pride ourselves not only on its impressive dimensions but also on our steadfast dedication to unparalleled customer service. Recognizing the multitude of choices customers have for automotive care, we are committed to earning your business and referrals through our consistent efforts every single day. Our passion extends beyond the physical space, creating an environment where exceptional service is not just a goal but a daily commitment.

Avatar_small
Scott M. Ridgway 说:
2024年1月03日 15:15

Unlock the mysteries of passion with "Secret Tantric Arts." Delve into an ancient realm where sensuality becomes an exquisite art form, revealing hidden pathways to pleasure and connection. Experience the magic of these sacred techniques, guiding you to unparalleled depths of intimacy and bliss.

Avatar_small
減脂 说:
2024年1月03日 21:36

To begin your body shaping journey, it's essential to set clear and achievable goals. Determine what specific areas of your body you want to work on and what kind of results you want to see.

Avatar_small
intercomrepair 说:
2024年1月08日 13:48

In an era where security is paramount, ensuring the safety of your home or business is a top priority. One effective way to bolster security measures is through the installation of a door buzzer system. Door buzzers provide a controlled means of access, allowing only authorized individuals to enter a premises while keeping unwanted visitors at bay.

Avatar_small
Biofouling Managemen 说:
2024年1月08日 14:41

BioMarine Services Ltd is a specialist service provider in the sampling & analysis, service of BWMS. We have extensive experience in ballast water management system commissioning testing, US-VGP sampling, scrubber sampling, BWMS maintenance, biofouling management, and underwater inspection.

Avatar_small
intercomrepairny 说:
2024年1月10日 12:56

We helps you select the suitable with excellent style and reliability, In addition, We has more than 20 years of experience in Installs new or upgrade old intercom systems to new and modern video intercom system use exiting wires for residential apartment building.

Avatar_small
Phuket Apartment For 说:
2024年1月21日 21:06

Seize the opportunity to own a piece of paradise with a Phuket apartment for sale. Experience coastal luxury and unmatched tranquility, making every day a retreat in the heart of this tropical haven.

Avatar_small
how to manifest a be 说:
2024年1月22日 20:58

"Manifesting a better relationship with your boyfriend starts with open communication and active listening, fostering a deeper understanding. Set positive intentions, envisioning a harmonious and loving connection. Practice gratitude for the present and visualize shared goals for the future. Cultivate emotional connection through quality time and thoughtful gestures. Trust the process, and as you both invest in growth, watch your relationship blossom into a fulfilling and joyful partnership."

Avatar_small
Pro Click Speed 说:
2024年1月25日 01:21

Pro Click Speed is an absolute game-changer, elevating precision and responsiveness to new heights. Its seamless performance ensures a competitive edge, making it a must-have for gamers and professionals alike. The tactile feedback coupled with lightning-fast response times creates an immersive and efficient user experience. With Pro Click Speed, every click becomes a powerful tool, enhancing productivity and unleashing the full potential of your actions. Say goodbye to lag and hello to a new era of swift, reliable clicking.

Avatar_small
Electriic Gear 说:
2024年1月25日 01:23

"Electric gear is the heartbeat of modern innovation, seamlessly powering our daily lives. From sleek gadgets to eco-friendly vehicles, it's the silent force driving progress. Its efficiency sparks a revolution in energy consumption, paving the way for a sustainable future. With each electrical pulse, we witness the dynamic synergy of technology and power. Electric gear: where innovation meets electrifying potential."

Avatar_small
Faraday Protection P 说:
2024年1月29日 18:45

In an era dominated by electronic devices and constant connectivity, concerns about privacy and security have become more prevalent than ever. As technology advances, so does the need for protective measures against potential threats like electromagnetic interference (EMI) and radiofrequency interference (RFI). Faraday products have emerged as a practical solution to safeguard sensitive information and electronic devices. This article will delve into the diverse range of Faraday products, from fabric kits to Faraday boxes, highlighting their applications and benefits.

Avatar_small
平衡淨膚 说:
2024年2月01日 13:17

Discover the best you with Nu Skin's innovative anti-aging skin care products and rewarding business opportunities, while making a difference in the world

Avatar_small
光滑年輕肌 说:
2024年2月01日 17:30

What's the secret to staying young? It means living optimistically and confidently every day, doing what you like to do, and living a wonderful life! With innovative scientific research and development, we have developed new ways to help you feel younger from the inside out. And we integrate our research findings into life and launch a series of powerful skin care products and supplements.

Avatar_small
slot demo gratis 说:
2024年2月06日 13:31

Dream303 is a trusted IDN, IDN live & live casino slot site, register & login for dream 303 online slots at the alternative link dream303 Asia. Get lots of promotions from dream 303such as welcome bonus, deposit bonus, and cash discount. Feel satisfied by joining dream 303 promotions.

Avatar_small
Physical therapy Bri 说:
2024年2月11日 14:56

TruWell Physical Therapy is a physical therapy clinic that provides personalized care from the most qualified therapists. Our treatments have helped many patients get back on their feet and resume their lives again.

Avatar_small
Biofouling Managemen 说:
2024年2月12日 13:52

Our skilled group includes engineers and marine biologists. We've partnered with shipowners, administrations, manufacturers, class societies, and test labs previously, striving to provide top-notch services.

Avatar_small
Door buzzer installa 说:
2024年2月14日 15:40

We helps you select the suitable with excellent style and reliability, In addition, We has more than 20 years of experience in Installs new or upgrade old intercom systems to new and modern video intercom system use exiting wires for residential apartment building.

Avatar_small
blockchainreporter 说:
2024年3月01日 14:56

The Tonic Crypto platform is an integral part of the DeFi ecosystem, enabling users to access a range of decentralized financial services without relying on traditional banking institutions.

Avatar_small
LASER TATTOO REMOVAL 说:
2024年3月27日 05:45

In recent years, laser tattoo removal has become increasingly popular as people seek to erase the ink of the past. Fort Lauderdale, with its vibrant culture and diverse population.

Avatar_small
BizSAFE 说:
2024年4月01日 04:24

ExpertRA is an intelligent software that guides companies to conduct their bizSAFE documentation & risk assessments systematically.

Avatar_small
The Best Massage Exp 说:
2024年4月04日 04:28

In the realm of intimate exploration and heightened self-discovery, the practice of Tantric Massage stands as a captivating gateway to a world where pleasure intertwines with spirituality.

Avatar_small
Carbon Intensity Ind 说:
2024年6月07日 13:56

BioMarine Services Ltd is a specialist service provider in biofouling management, the sampling & analysis, service of BWMS. We have an extensive experience in ballast water management system D2 Commissioning Testing, US-VGP sampling, scrubber sampling, BWMS maintenance, biofouling management, and underwater inspection.

Avatar_small
Russian manicures 说:
2024年6月25日 17:58

hi, your website is really good. I truly do appreciate your give good results <a href="https://www.brooklynbeautylounge.com/">Russian manicures</a>.

Avatar_small
Brooklynbeauty Loung 说:
2024年6月27日 12:49

Find the perfect bridal look with wedding makeup near me. Our expert makeup artists specialize in creating stunning, long-lasting looks for your special day. Book your appointment today for the best wedding makeup near me and make your wedding day unforgettable.

Avatar_small
Brooklynbeauty Loung 说:
2024年6月27日 17:47

Get a perfect, sun-kissed glow with the best spray tan near me. Our expert technicians deliver flawless, natural-looking results customized to your skin tone. Book your appointment today for the best spray tan near me and enjoy a radiant, streak-free finish.

Avatar_small
spray tan training 说:
2024年6月29日 16:10

Unlock the secrets to professional spray tan expertise with comprehensive training programs. Explore accredited courses, expert techniques, and hands-on learning opportunities to master the art of sunless tanning. Whether you're starting a career or enhancing your skills, discover how proper training can elevate your spray tan services.

Avatar_small
Buy Diazepam Online 说:
2024年7月13日 21:02

Curious about Yellow Xanax Bars? Discover their uses and benefits, and find trustworthy sources for purchase. Ensure a safe and informed decision for your needs.

Avatar_small
Green Building 说:
2024年7月18日 14:35

Great insights! I checked out your site and found it very informative. For excellent SEO services, visit website.

Avatar_small
Best Spray Tan Servi 说:
2024年7月25日 01:46

Discover the best spray tan services in NYC for a flawless, sun-kissed glow. Find top salons offering expert application and high-quality products for a beautiful, natural-looking tan. Enjoy the best spray tan services in NYC for a radiant and long-lasting result.

Avatar_small
Permanent eyebrows B 说:
2024年7月25日 02:39

Achieve flawless brows with permanent eyebrows in Brooklyn. Discover top salons offering expert microblading and permanent makeup services to give you natural-looking, perfectly shaped eyebrows that last. Find the best places for permanent eyebrows in Brooklyn for a beautiful, hassle-free look every day.

Avatar_small
myalphafund 说:
2024年8月05日 15:14

I really appreciate this post! I've been searching everywhere for this information and finally found it on Google

Avatar_small
Ballast water sensor 说:
2024年10月18日 14:00

BioMarine Services Ltd is a leading specialist in biofouling management and comprehensive Ballast Water Management System (BWMS) services, including sampling, analysis, and maintenance. We bring extensive experience in D2 Commissioning Testing, US-VGP sampling, scrubber sampling, BWMS maintenance, and underwater inspections.

Avatar_small
Los Angeles tech sup 说:
2024年10月21日 19:02

Thanks for this valuable information! Your blog always provides clear and actionable advice!

Avatar_small
milking table massag 说:
2024年10月23日 15:11

milking table is more than just an object; it's a canvas for exploration, a stage for intimate connections that go beyond the ordinary.
<a href="https://www.toneecompanion.com/unlocking-the-benefits-of-a-milking-table-milking-massage">milking table massage</a>

Avatar_small
Termite Control 说:
2024年10月28日 15:38

Our highly trained pest control professionals have a consistent, proven approach to addressing your unique pest problems. Request a free quote right row.<a href="https://delvallepestcontrol.com/">Termite Control</a>

Avatar_small
need to sell propert 说:
2024年11月04日 17:50

Thanks for the helpful info on Real Estate Investor - Home - I buyers Florida! I’m working on similar ideas at <a href="https://ibuyersflorida.com/">need to sell property fast</a>. Appreciate the insights!

Avatar_small
Kitchen Upgrades 说:
2024年11月07日 22:56

Enhance your kitchen with our Kitchen Upgrades! From new countertops to modern appliances, we offer affordable solutions to refresh and improve your kitchen’s style and functionality.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter