Filters

Display value in basic Filters

by mohitagrawalmca

HTML

<div ng-controller="StdController">
  <div>Filters</div>
   <hr/>
  <table>
    <tr>
      <th>Student Name </th>
      <th>Class</th>
      <th>Fee</th>
      <th>Fee Date</th>
    </tr>
    <tr ng-repeat="std in StdDetails | limitTo : 1 :0">
      <td>{{std.StdName | uppercase }} </td>
      <td>{{std.StdClass | lowercase }}</td>
      <td>{{std.Fee | currency:'Rs. '}}</td>
      <td>{{std.FeeDate | date: "dd-MMM-yyyy" }}</td>
    </tr>
  </table>
  <hr/>
  <b>JSON Format:</b><br/>
  {{StdDetails|json }}
  <hr/>
 

</div>

CSS

th {
  border: 1px solid;
}

td {
  border: 1px solid;
}

table {
  border: 1px solid;
}

JavaScript

var myApp = angular.module('myApp', []);
myApp.controller('StdController', function($scope) {
  var StdDetails = [{
    StdName: "Mohit",
    StdClass: "MCA",
    Fee: 1000,
    FeeDate: new Date('12/15/2015')
  }, {
    StdName: "Amit",
    StdClass: "B.Sc.",
    Fee: 1000,
    FeeDate: new Date('12/15/2015')
  }];
  $scope.StdDetails = StdDetails;
    $scope.Name="Amit";
});