首页 > Web开发 > 详细

[AngularJS] ngMessageFormat

时间:2015-12-21 07:01:09      阅读:506      评论:0      收藏:0      [点我收藏+]

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

[AngularJS] ngMessageFormat

原文:http://www.cnblogs.com/Answer1215/p/5062362.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!