ngMessageFormat can be installed via npm using the following command:

$ npm install angular-message-format --save
angular.module('myApp', ['ngMessageFormat']);

Pluralization with ngMessageFormat

With ngMessageFormat included, we can overload Angular expressions using a comma like this:

{{EXPRESSION, TYPE,
=VALUE { MESSAGE }
...
}}

Example:

{{numberOfMessages, plural,
=0 { You have no new messages }
=1 { You have one new message }
other { You have # new messages }
}}
{{genderExpression, select,
male { Send him a message. }
female { Send her a message. }
other { Send them a message. }
}}

Link: http://blog.thoughtram.io/angular/2015/12/10/ng-message-format-the-unheard-feature-in-angular.html

最新文章

  1. ReactJS入门(一)—— 初步认识React
  2. 3个普通IO识别22个按键试验(转)
  3. Cocoapods在OS X Yosemite上升级时 报错的解决方法
  4. 《Head First Java》读书笔记(1) - Java语言基础
  5. 在CentOS6上编译安装实现LAMP(php-modules)+phpMyAdmin安装过程全记录
  6. CTF--web
  7. 【Java并发.4】对象的组合
  8. thinkcmf 相关
  9. webapi框架搭建-webapi异常处理
  10. 错误不能中断(不许因错误或异常而产生阻断性Bug)
  11. Jenkins分布式构建
  12. jquery animate动画持续运动
  13. python之列表操作
  14. VMware vCenter Server 6.5.0 U1g
  15. PHP的XML Parser(转)
  16. PHP------数组和对象相互转化,stdClass Object转array
  17. PAT——1075. 链表元素分类(25)
  18. Linux系统下超级用户密码的修改
  19. VMware虚拟机安装Centos7详细步骤过程(图文)[转载]
  20. 《从零开始学Swift》学习笔记(Day 17)——Swift中数组集合

热门文章

  1. 创建DBLink语句
  2. trie树信息抽取之中文数字抽取
  3. iOS开发之四张图说明GCD(Grand Central Dispatch)附Test源码
  4. cas sso单点登录系列4_cas-server登录页面自定义修改过程(jsp页面修改)
  5. 交叉编译:cannot find /lib/libc.so.6 collect2: ld returned 1 exit status
  6. python 文件系统
  7. C#制作ActiveX控件及部署升级(摘自网络)
  8. jquery工具函数browser() 辨别浏览器
  9. 无法嵌入互操作类型“Microsoft.Office.Interop.Word.ApplicationClass”。请改用适用的接口。
  10. WebService cxf 接口中获得拦截器参数