I am trying to print a date and time in my page with values coming from an Sql Server. The format of the date that is returned is like so:
/Date(1510563600000)/
angular
$filter('date')(date, format, timezone)
$scope.GetTimelineByUserIdAndProjectId = function (userId, projectId) {
var obj = { "userId": userId, "projectId": projectId }
$http.post('/Admin/GetTimelineByUserIdAndProjectId', obj)
.then(function (response) {
$scope.userTimeline = response.data;
})
}
html
<ul class="timeline timeline-inverse" ng-repeat="u in userTimeline">
<li class="time-label">
<span class="bg-red">
{{u.StartDateTime | date:'medium'}}
</span>
</li>
<li>
<i class="fa fa-clock-o bg-gray"></i>
</li>
I want the date format to be day/month/year hour:minutes.
When I run this program, I got the $filter is not defined so I place it in my controller like this:
var app = angular.module('adminApp', []);
app.controller('adminController', function ($scope, $http, $filter) {
but it then gives me an error of angular.js:14642 ReferenceError: date is not defined