Hey everyone, I'm currently facing an issue where I need to pass each date through a function in order to get the desired result. Let's take a closer look at the code snippet:
<md-list>
<md-divider ></md-divider>
<md-subheader class="md-no-sticky">Replies</md-subheader>
<md-list-item class="md-2-line" ng-repeat="reps in replies">
{{reps.replyCreatorDate}}
<ng-md-icon icon="phone" style="fill: white" size="20"></ng-md-icon>
<img ng-src="{{reps.replyCreatorAvatar}}" class="md-avatar" alt="Something Went Wrong"/>
<div class="md-list-item-text">
<h3> {{reps.replyCreatorUsername}} </h3>
<p> {{reps.replyCreatorValue}} </p>
</div>
<md-button class="md-secondary md-icon-button" aria-label="call">
<ng-md-icon icon="phone" style="fill: white" size="20"></ng-md-icon>
</md-button>
</md-list-item>
</md-list>
As you can see, reps.replyCreatorDate returns a date number like '1460924923708' which is not user-friendly. To display it as '2 hours ago' or '1 day ago', I have a predefined service that can handle this conversion for me with the following line of code:
timeService.getTimeF(new Date(parseInt($scope.replyCreatorDate)))
The challenge I'm facing now is figuring out how to pass each $scope.replyCreatorDate through this function so that it renders correctly. Any assistance would be greatly appreciated!