Why does the console.log execute twice even though I am only calling it once.
(为什么console.log执行两次,即使我只调用一次。)
You can see the console.log by inspecting the console on this page. (您可以通过在此页面上检查控制台来查看console.log。)
I am using angularjs to retrieve the data that I am trying to console. (我正在使用angularjs检索要尝试控制台的数据。)
I couldn't find any online resources pointing this being an issue with angularjs Below is the js but it is also available when viewing source on the page. (我找不到任何在线资源,指出这是angularjs的问题。下面是js,但在查看页面上的源代码时也可用。)
JS
(JS)
var app = angular.module('myApp', []);
app.controller('myController', function ($scope, $http, $filter) {
$http.get("files/tickets.json")
.then(function (response) {
var status = response.status;
var statusText = response.statusText;
var headers = response.headers;
var config = response.config;
$scope.tickets = response.data;
$scope.ticketsA = $scope.tickets["ticketsA"];
$scope.ticketsB = $scope.tickets["ticketsB"];
console.log($scope.tickets);
console.log("Testing...");
...
}).catch(function (response) {
console.log(response);
})
});
ask by Jigoro Kano translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…