Create Date type in ng-init

Description

The following code shows how to create Date type in ng-init.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--  w ww . j a v a  2  s.c  om-->
<body>
  <div ng-app ng-init="modifiedDate = '2013-07-09T22:22:22.2425232+08:00'">
    <input type="text" ng-model="modifiedDate"/>
    <h1>{{ modifiedDate | date:'short' }}</h1>
    <h1>{{ modifiedDate }}</h1>
</div>
<script type='text/javascript'>
</script>
</body>
</html>

Click to view the demo





















Home »
  AngularJS »
    AngularJS Example »




Controller
Directives
Expression
Filter
Form
Inject
Scope
Server
Style
Template
Utilities