ng-pluralize directive

We always have problem in singularizing and pluralizing while displaying information to users.
For instance consider below statement.

"you have 2 new requests" is the information that we want to display.

The above statement works well as long as we have more than one request. But when there is only one request, the statement would look something like
"you have 1 new requests". Honestly it should have been "you have 1 new request".












<ng-pluralize count="number" when="{'1': 'You have one new request.',
'other': 'You have {} new requests.'}">
</ng-pluralize>

If the value of $scope.number=1 then it would output "You have one new request" else it would display pluralized message.

Demo can be found here

Comments

  1. The AngularJS framework works by first reading the HTML page, which has embedded into it additional custom tag attributes. This blog gives great view for Angular.js beginners. Learn Angular.js from the best Angular.js Online Training in your locality at CatchExperts.com

    ReplyDelete

Post a Comment

Popular Posts