angular.js - The value of ng-repeat is processed and then bound to the page
我想大声告诉你
我想大声告诉你 2017-05-15 17:08:11
0
1
572
<p ng-switch="list.state">
     <p ng-switch-when="0">
         <p class="rob text-center btn-rob" ng-if="list.openTime<=0">
             <p class="content">开抢<br></p>
         </p>
     
         <p class="rob text-center btn-full" ng-disabled="true" ng-if="list.openTime>0">
            <p class="content">即将开标<br><span >这里需要倒计时</span></p>
         </p>
    </p>
    
    <p ng-switch-when="1" class="rob text-center btn-full" ng-click="jump('/invest')" ng-disabled="true">
        <p class="content">满标</p>
     </p>
</p>

The above code: Countdown ng-repeat can get the millisecond difference list.openTime. The string that needs to be made into a countdown is displayed in the span. What should I do?

我想大声告诉你
我想大声告诉你

reply all(1)
阿神

list.openTimeThis variable itself should already exist in the controller. Normally you should have this sentence in your controller

var list = this;

If this list.openTime is just a value sent back by the server and does not need to be sent back to the server, then you can directly operate the period in the controller.

//controller
list.openTime=Math.round(list.openTime);//把时间转化成时间戳
$interval(function () {
    list.openTime -= 1;//每秒减一,在页面把这个格式化成时间格式
}, 1000);
//html
<span>{{list.openTime|date:"HH:mm:ss"}}</span>

If list.openTime is still useful, then clone it to another variable and use another variable to decrement.
Strictly speaking, the decrement function should be put into a variable and canceled when the decrement ends.
That’s probably what it looks like.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template