Controller:
$scope.locTime= function() { $http.get('/user/time/') .then(function(response) { $scope.locationTime = response.data[0].locationTime; }); Page:
<html> <head> <script src="angular.min.js"></script> <script src="controller.js"></script> </head> <body onload="locTime()"> <h1>Время пользователя</h1> <script> var times = //locationTime//; console.log(times); </script> </body> </html> In my case, when displaying the values of the angular, instead of curly brackets, double slash is used. How to display the resulting locationTime value in the console?
thenwriteconsole.log('LOCTIME=', response.data[0].locationTime)- nörbörnëntimesvariable to the controller, and in the controller, assign the value to it, and then output it on the page itself. - Sergey Glazirin