簡體   English   中英

不會通過將對象推入Array來更新DOM,在推入數據后會更新數據庫

[英]DOM is not updated by pushing object into the Array,database is updated after pushing the data

我已經驗證了數據庫中的數據,該數據正在更新,但是DOM沒有更新。

 <ul>
   <li ng-repeat="aReview in reviewList">    
    ....
    ....
   </li>
 </ul>
<script>
if(globalMethods.stringValidation($scope.reviewList))
{
   $scope.reviewList.push(optData);
}
else
{
   $scope.reviewList=[];
   $scope.reviewList.push(optData);
}
</script>

如果您使用第三方庫來處理您的數據,Angular可能不會意識到數據的變化。 為了使角度能夠重新檢查事物,您必須在處理數據后手動調用$ scope。$ apply()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM