简体   繁体   English

不会通过将对象推入Array来更新DOM,在推入数据后会更新数据库

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

I have verified data in the database, it is getting updated, but DOM is not getting updated. 我已经验证了数据库中的数据,该数据正在更新,但是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>

If you are using a third party libraries to manipulate your data, angular may not be aware of changes to data. 如果您使用第三方库来处理您的数据,Angular可能不会意识到数据的变化。 To get angular to recheck things, you have to mannually invoke $scope.$apply() after manipulating your data 为了使角度能够重新检查事物,您必须在处理数据后手动调用$ scope。$ apply()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM