Angularjs 将数据从json自动刷新到angular
你好,我想创建Angularjs 将数据从json自动刷新到angular,angularjs,json,Angularjs,Json,你好,我想创建自动刷新,因此当数据更新时,字段也会更改。因此,我尝试使用$interval。请检查我的脚本 <script> var app = angular.module('myApp', []); app.controller('listsupport', function($scope,$http,$interval) { var count = 0; $http.get("<?=base_url();?>newch
自动刷新
,因此当数据更新时,字段也会更改。因此,我尝试使用$interval
。请检查我的脚本
<script>
var app = angular.module('myApp', []);
app.controller('listsupport', function($scope,$http,$interval) {
var count = 0;
$http.get("<?=base_url();?>newchat/listsupport").then(function (response) {
$scope.names = response.data;
$interval( function(){listsupport();}, 10000);
});
});
</script>
var-app=angular.module('myApp',[]);
app.controller('listsupport',函数($scope,$http,$interval){
var计数=0;
$http.get(“newchat/listsupport”)。然后(函数(响应){
$scope.names=response.data;
$interval(函数(){listsupport();},10000);
});
});
使用上面的脚本,我得到一个错误listsupport未定义
。我怎样才能修好它?提前感谢。试试这个
var app = angular.module('myApp', []);
app.controller('listsupport', function($scope, $http, $interval) {
this.interval = $interval(function() {
$http.get("<?=base_url();?>newchat/listsupport").then(function(response) {
$scope.names = response.data;
});
}, 10000);
});
var-app=angular.module('myApp',[]);
app.controller('listsupport',函数($scope,$http,$interval){
this.interval=$interval(函数(){
$http.get(“newchat/listsupport”)。然后(函数(响应){
$scope.names=response.data;
});
}, 10000);
});
您在哪里定义函数列表支持
?