我有一個Angularjs應用程序。在應用程序中,我有一個表格,通過ng-repeat和API連接顯示數據。這意味着我通過控制器中的API連接獲取信息。 其中一個數據項是「日期和時間」。 當我使用ng-repeat時,我會顯示數據庫中的日期,但我想將其顯示爲倒計時,而不是完全像數據庫中那樣。使用ng-repeat和API連接創建AngularJS倒數
下面是HTML代碼:
<tbody>
<tr class="info" id="{{$index}}" ng-repeat="matches in future_match">
<td style="text-align: center;">
<img src="asset/images/loltables.png"></td>
<td style="font-weight:bold;">{{matches.matche_title}} - Best Of {{matches.matche_bestOf}}
<br></br> <center><img ng-src="{{matches.competitors.0.c_img}}" style="padding-right: 30px; padding-bottom: 15px;"/><img ng-src="{{matches.competitors.1.c_img}}" style="padding-bottom: 15px;"/><br>{{matches.competitors.0.c_short_name}} <b>vs.</b> {{matches.competitors.1.c_short_name}}</center></td>
<td style="text-align: center;"><i class="fa fa-dollar" style="color:green;"></i>50 </td>
<td style="text-align: center;">50</td>
<td style="text-align: center;">{{matches.matche_start}}</td>
<td style="text-align: center;"><button type="button" data-toggle="modal" data-target="#ava_gold" ng-click="select(matches)" class="btn btn-info btn-circle">Enter</button></td>
</tr>
</tbody>
只想將其顯示爲倒計時並且不喜歡它是在數據庫中,其是2015年12月3日 10:00:00 GTM
我是Angularjs的新手,所以我需要它簡單易用。
感謝
走在這個
瞬間JS還提供了這一點::比你能在HTML頁面中使用常規管道語法使用https://github.com/urish/angular-moment#am-time-ago-directive您CA n總是看看他們如何在源代碼中執行它... –