Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
<some-element [ngPlural]="value"> <ng-template ngPluralCase="=0">there is nothing</ng-template> <ng-template ngPluralCase="=1">there is one</ng-template> <ng-template ngPluralCase="few">there are a few</ng-template> </some-element>
class NgPlural { constructor(_localization: NgLocalization) ngPlural addCase(value: string, switchView: SwitchView) : void }
[ngPlural]
Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees that match the switch expression's pluralization category.
To use this directive you must provide a container element that sets the [ngPlural]
attribute to a switch expression. Inner elements with a [ngPluralCase]
will display based on their expression:
[ngPluralCase]
is set to a value starting with =
, it will only display if the value matches the switch expression exactly,constructor(_localization: NgLocalization)
ngPlural
addCase(value: string, switchView: SwitchView) : void
exported from common/index, defined in common/src/directives/ng_plural.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/common/index/NgPlural-directive.html