Angularjs Filters

Advertisements

AngularJS DOM AngularJS Forms

Angularjs Filters

Filter are mainly used for modify the data. Filters can be added to expressions and directives using a pipe (|) character. Following Filter are use in AngularJs;

S.No.NameDescription
1uppercaseconverts a text to upper case text.
2lowercaseconverts a text to lower case text.
3currencyformats text in a currency format.
4filterfilter the array to a subset of it based on provided criteria.
5orderByorders the array based on provided criteria.

uppercase

uppercase filter are used for converting lower case text to upper case text. It is use to expression with pipe character.

Example

<div ng-app="" ng-controller="personController">
Enter first name:<input type="text" ng-model="name"><br/>
<p>The name is {{ name | uppercase }}</p>
</div>

<script>
function personController($scope) {
    $scope.name="Porter"
}
</script>

Example

Enter first name:

The name is {{ name | uppercase }}

lowercase

lowercase filter are used for converting upper case text to lower case text. It is use to expression with pipe character.

Example

<div ng-app="" ng-controller="personController">
Enter first name:<input type="text" ng-model="name"><br/>
<p>The name is {{ name | lowecase }}</p>
</div>

<script>
function personController($scope) {
    $scope.name="PORTER"
}
</script>

currency

Add currency filter to an expression returning number using pipe character. Below we print total cost of items.

Example

<div ng-app="" ng-controller="personController">
<input type="number" ng-model="quantity"><br />
<input type="number" ng-model="price">

<p>Total = {{ (quantity * price) | currency }}</p>

</div>

<script>
function personController($scope) {
    $scope.quantity=10;
    $scope.price=1;

}
</script>

AngularJS DOM AngularJS Forms

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements