Wednesday, July 1, 2015

AngularJS JSON Filter

AngularJS filters are used to format/transform the data displayed in the view, filters can be used with expressions, ng-bind, ng-repeat etc and act upon the data from the model. The JSON filter is used to format JSON data in the view

The following is the syntax for using json filter
{{ <string > | json }}

The following is an example of using json filter.

<html ng-app>
    <meta charset="utf-8" />
    <title>AngularJS - Basic</title>
    <script src="angular.min.js"></script>
          <div ng-init="Employees=[
                   <b>Without json display:</b> {{Employees}} <br/><br/>
                   <b>With json filter:</b> {{Employees | json}}


Search Flipkart Products:

No comments: