Update bootstrap angularjs table with real time data on the fly using ng-repeat

余生颓废 提交于 2019-12-04 19:59:37

This happens because you are replacing whole object.

Angular is watching the previous one, which you overide by

$scope.fileList = res;

Easiest think is using "controller as" syntax of controllers so your object will be taken as property in template.

https://docs.angularjs.org/api/ng/directive/ngController

So your controller would become

... 
this.getFiles = function(res)
     {
        this.fileList = res;
        console.log(res);
     }

and template

<div ng-controller="NameOfController as fileCtrl"

...

<tr ng-repeat="file in fileCtrl.fileList">

after that angular watch property of fileCtrl object and not the primitive value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!