I am attempting to format a dateTime returning from a C# web service, formatted as '2016-01-01T00:00:00' to a standard MM/dd/yyyy format in Angular. The date in question is in a select list.
Here is the AngularJS:
angular.module('myApp', [])
.controller('ctrl', function ($scope) {
$scope.options = [{
name: "Date One",
date: "2015-01-01T00:00:00"
}, {
name: "Date Two",
date: "2016-01-01T00:00:00"
}];
});
Here is the html:
<body ng-app="myApp">
<div ng-controller="ctrl">
<select class="form-control" ng-model="selectedOption" ng-options="option.name + ' ' + option.date | date:'MM/dd/yyyy' for option in options"></select>
</div>
</body>
You can view this online at https://jsfiddle.net/5s706vLq/7/