AngularJS ng-pluralize Directive Last Updated : 16 Aug, 2022 Comments Improve Suggest changes Like Article Like Report The ng-pluralize Directive in AngularJS is used to specify the message to display according to the en-us localization rules. The en-us localization rules are bundled with AngularJS. The default plural category in AngularJS is "one" and "other". Syntax: The ng-pluralize Directive can be used: As element: <ng-pluralize count="" when="string" [offset="number"]> Contents... </ng-pluralize> As attribute: <element ng-pluralize count="" when="string" [offset="number"]> Contents... </element>Parameter Values: count: It refers to the value of the count attribute which is used by Angular expression.when: It is used to specify the mapping between the actual string and the plural categories. The attribute value must be in JSON object style.offset: It specifies the offset attribute to deduct from the total number.Example 1: This example uses the ng-pluralize Directive to display content. HTML <!DOCTYPE html> <html> <head> <title>ng-pluralize Directive</title> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"> </script> </head> <body ng-app="app" style="padding:20px"> <h1 style="color:green;">GeeksforGeeks</h1> <h2>ng-pluralize Directive</h2> <div ng-controller="geek"> <div ng-init="Hotel=[0, 1, 2, 3]"> Choose from list: <select ng-model="booking" ng-options="booking as booking for booking in Hotel"> </select><br><br> <ng-pluralize count="booking" when="{ '0':'No booking available', '1':'{{booking}} booking available', '2':'{{booking}} bookings available', '3':'{{booking}} bookings available', }"> </ng-pluralize> </div> </div> <script> var app = angular.module("app", []); app.controller('geek', ['$scope', function($scope) { $scope.booking = 0; }]); </script> </body> </html> Output: Example 2: This example uses the ng-pluralize Directive to display the input text content. HTML <!DOCTYPE html> <html> <head> <title>ng-pluralize Directive</title> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"> </script> </head> <body ng-app="app" style="text-align:center"> <h1 style="color:green;">GeeksforGeeks</h1> <h2 style="">ng-pluralize Directive</h2> <div ng-controller="geek"> <p>Input Names separated by comma(, ):</p> <textarea class="form-control" ng-model="people" ng-list=", "> </textarea><br><br> <ng-pluralize count="people.length" offset="2" when="{ '0': 'You got no viewers.', '1': '{{people[0]}} is viewing.', '2': '{{people[0]}} and {{people[1]}} are viewing.', 'one': '{{people[0]}}, {{people[1]}} and one other person is viewing.', 'other': '{{people[0]}}, {{people[1]}} and {} other people are viewing.'}"> </ng-pluralize> </div> <script> var app = angular.module("app", []); app.controller('geek', ['$scope', function($scope) { $scope.people = []; }]); </script> </body> </html> Output: Comment More infoAdvertise with us Next Article AngularJS ng-value Directive V Vishal Chaudhary 2 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Similar Reads AngularJS ng-value Directive The ng-value Directive in AngularJS is used to specify the value of an input element. This directive can be used to achieve the one-way binding for the given expression to an input element, especially when the ng-model directive is not used for that specific element. It is supported by <input> 2 min read AngularJS ng-paste Directive The ng-paste Directive in AngularJS is used to specify custom behavior functions when the text in input fields is pasted into an HTML element. It can be used to call a function that will be triggered when the text is pasted into the input field. It is supported by <input>, <select> and 2 min read Angular 10 NgPlural Directive In this article, we are going to see what is NgPlural in Angular 10 and how to use it. The NgPlural in Angular10 is used to Add or remove DOM sub-trees based on a numeric value. Syntax: <li *NgPlural='condition'></li> NgModule: Module used by NgPlural is: CommonModule  Selectors: [NgPlu 1 min read Angular10 NgPluralCase Directive In this article, we are going to see what is NgPluralCase in Angular 10 and how to use it. The NgPluralCase in Angular10 is used to create a view that will be added or removed from the parent NgPlural when the given expression matches the plural expression. We can use the values to make the output p 1 min read AngularJS ng-pattern Directive The ng-pattern Directive in AngularJS is used to add up pattern (regex pattern) validator to ng-Model on an input HTML element. It is used to set the pattern validation error key if input field data does not match a RegExp that is found by evaluating the Angular expression specified in the ng-patter 2 min read AngularJS ng-style Directive The ng-style Directive in AngularJS is used to apply custom CSS styles on an HTML element. The expression inside the ng-style directive must be an object. It is supported by all the HTML elements. Syntax: <element ng-style="expression"> Content ... </element>Parameter: expression: It rep 2 min read Like