JSON Array Filters

Array Filters

by manoj_antony32

HTML

<h4>Array JSON filter</h4>
<h5>The json filter converts a JavaScript object into a JSON string.</h5>
<div ng-app="CurrencyApp" ng-controller="CurrencyController">
 <pre>{{todos | json: 8}}</pre>
 </div>

JavaScript

var myApp = angular.module('CurrencyApp', []);
myApp.controller("CurrencyController", ['$scope', function($scope) {

$scope.todos = [
    {id: 1,title: 'Learn AngularJS', description: 'Learn AngularJS', done: true, date: new Date()}  ,
    {id: 2,title: 'Explore ui-router', description: 'Explore and use ui-router instead of ngRoute', done: true, date: new Date()}  ,
    {id: 3,title: 'Play with Restangular', description: 'Restangular seems better than $resource, have a look', done: false, date: new Date()}  ,
    {id: 4,title: 'Try yeoman', description: 'No more labour work..use Yeoman', done: false, date: new Date()}  ,
    {id: 5,title: 'Try MEANJS', description: 'Aah..MEANJS stack seems cool..why dont u try once', done: false, date: new Date()}                
            ];
}]);