Я новичок в программировании на AngularJS. Поэтому я вызываю функцию области видимости getDevice () в моем html и, похоже, попадаю в бесконечный цикл. Журнал консоли:
angular.js:14800 Error: [$rootScope:infdig] http://errors.angularjs.org/1.6.9/$rootScope/infdig?p0=10&p1=%5B%5D
at angular.js:88
at m.$digest (angular.js:18418)
at m.$apply (angular.js:18649)
at l (angular.js:12627)
at t (angular.js:12871)
at XMLHttpRequest.A.onerror (angular.js:12799)
Код:
App.js
var myApp = angular.module('myApp', []);
myApp.controller('myController', function($scope, $location, $http)
{
$scope.getDevice = function(deviceId)
{
$http.get('http://localhost:8080/client/' + deviceId + '/receive/device')
.then(function (response)
{
$scope.jsondata = response.data;
})
console.log("working");
};
});
HTML
<body>
<div ng-app="myApp" ng-controller="myController">
{{getDevice("elsysDev")}}
</div>
</body>
Так что я делаю не так?