AngularJS刷新似乎不起作用

时间:2015-11-25 06:51:56

标签: javascript angularjs

我有一个简单的2个部分,我想要新旧。一旦完成新的并且正在调用套接字old = new和new应为空。事情是一切仍然保持在上(新)部分。 最后一个套接字负责管理它。

控制器:

<div ng-controller="DepositsCtrl">
            <h2>Deposits</h2>
            <hr class="line-under">
            <section class="round section">
                <ul>
                    <li class="li-deposit" ng-repeat="deposit in deposits | orderBy:'-'">
                        <div class="deposit-person"><img class="small-avatar" ng-src="{{deposit.avatar}}" /> <span class="name">{{deposit.steamName}}</span> </div>
                        <div class="deposit-items">{{deposit.itemCount}} items</div>
                        <div class="deposit-value">{{deposit.depositValue}}$</div>
                    </li>
                    <li>
                        <hr class="line-under">
                        <h3 class="new-round text-center">New Round  <i class="fa fa-arrow-up fa-lg"></i></h3>
                    </li>
                </ul>
            </section>
            <section class="round section">
                <ul>
                    <li>
                        <div class="text-center center-block">
                            <img class="small-avatar" ng-src="{{avatarWinner}}" /><span>{{winnerSteamName}} has won {{roundValue}} with {{winnerChance}}% chance !</span>
                        </div>
                    </li>
                    <li class="li-deposit" ng-repeat="olddeposit in olddeposits | orderBy:'-'">
                        <div class="deposit-person"><img class="small-avatar" ng-src="{{olddeposit.avatar}}" /> <span class="name">{{olddeposit.steamName}}</span> </div>
                        <div class="deposit-items">{{olddeposit.itemCount}} items</div>
                        <div class="deposit-value">{{olddeposit.depositValue}}$</div>
                    </li>
                    <li>
                        <hr class="line-under">
                        <h3 class="new-round text-center">Previous Round  <i class="fa fa-arrow-up fa-lg"></i></h3>
                    </li>
                </ul>
            </section>
        </div>

Html:

int a = !! b ;

2 个答案:

答案 0 :(得分:1)

看了你的代码,并与Leandro一起阅读讨论,我很想知道。

你真的确定&#39; newRoundDeposit&#39;被释放和捕获?

很抱歉,如果这是一个愚蠢的问题,但对我来说,您的编码看起来是正确的。

答案 1 :(得分:0)

数组是对象,对象是通过引用分配的,因此当您执行$ scope.olddeposits = $ scope.deposits时,您将存储在存放中的引用分配给olddeposits。

尝试$scope.olddeposits = angular.copy($scope.deposits);,看看会发生什么。