Custom Date filter

Description

The following code shows how to use Custom Date filter.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--  www.j  ava  2  s  . c  om-->
<body>
  <body ng-app>
    <div ng-controller="MainCtrl">
        <input type="date"
               ng-model="date"
               value="{{ date | date: 'yyyy-MM-dd' }}" />
        <br/>{{ date | date: 'dd/MM/yyyy' }}
    </div>
</body>
<script type='text/javascript'>

function MainCtrl($scope) {
    $scope.date = new Date();
}
</script>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities