I am using Angular Material's md-dialog feature but having some issues getting the date filter working. Maybe someone can spot it and let me know if they have any idea on how to make this work. I can see that {{item.presentation.end_time}} and {{confSessionObj.session_nr}} are working but when I put the angular date filter, it doesn't recognize it.
Here's my code.
JS
$scope.showAdvanced = function(ev, confSession) {
var sessionID = confSession.id;
$.ajax({
type: "GET",
url: "/session-detail.php",
data: {id: sessionID},
success: function(data, response){
data = data.replace(/\\n/g, "\\n")
.replace(/\\'/g, "\\'")
.replace(/\\"/g, '\\"')
.replace(/\\&/g, "\\&")
.replace(/\\r/g, "\\r")
.replace(/\\t/g, "\\t")
.replace(/\\b/g, "\\b")
.replace(/\\f/g, "\\f");
$scope.returnedObj = JSON.parse(data);
$mdDialog.show({
locals: { confSessionObj: confSession, returnedObj: $scope.returnedObj },
controller: DialogController,
targetEvent: ev,
template:
'<div class="md-dialog-container">' +
'<md-dialog aria-label="Session Detail">' +
'<form ng-cloak>' +
'<md-toolbar md-scroll-shrink>'+
'<div class="md-toolbar-tools">'+
'<h4 style="color: #fff;">Session Details</h4>'+
'</div>'+
'</md-toolbar>'+
'<md-dialog-content>'+
'<md-list-item>'+
'<div class="md-dialog-content" id="dialog">'+
'<p class="md-body-2"><span class="md-custom-title">Session Title:</span> {{confSessionObj.session_nr}} - {{confSessionObj.session_name}}</p>'+
'<table class="table table-bordered table-striped table-hover table-responsive" id="dialogtable">'+
'<tr id="theader">'+
'<thead>'+
'<th>Talk Title</th>'+
'<th>Start Time</th>'+
'<th>End Time</th>'+
'<th>Speaker Name</th>'+
'</thead>'+
'</tr>'+
'<tr ng-repeat="item in returnedObj">'+
'<td>{{item.presentation.title}}</td>'+
'<td>{{item.presentation.start_time | date: "MM/dd/yyyy h:mma"}}</td>'+
'<td>{{item.presentation.end_time | date: "MM/dd/yyyy h:mma"}}</td>'+
'<td>{{item.speakers.firstname}} {{item.speakers.lastname}}</td>'+
'</tr>'+
'</table>'+
'</div>'+
'</md-list-item>'+
'</md-dialog-content>'+
'<md-dialog-actions layout="row">'+
'<md-button class="md-raised" ng-click="cancel()">Close</md-button>' +
'</md-dialog-actions>'+
'</form>'+
'</md-dialog>'+
'</div>',
parent: angular.element(document.body),
preserveScope: true,
clickOutsideToClose:true,
fullscreen: $scope.customFullscreen
});
},
error: function(e){
console.log(e.message);
}
});
};
function DialogController($scope, $mdDialog, confSessionObj, returnedObj) {
$scope.confSessionObj = confSessionObj;
$scope.returnedObj = returnedObj;
$scope.cancel = function() {
$mdDialog.cancel();
};
}