Angular.js每秒钟调用$ http.get

时间:2018-09-14 15:51:15

标签: angularjs http get seconds method-call

如何每秒调用 $ http.get 来更新我的页面?

var app = angular.module("CompanionApp", []);

app.controller('LoginController', function ($scope, $http) {
    $scope.LoginSubmit = function() {
        $http.get('/api/player/' + $scope.name)
        .then(function(res) {
            $scope.connected = res.data.connected;
            $scope.health = res.data.health;
            $scope.armour = res.data.armour;
        })
    };
});

0 个答案:

没有答案