Hi, I am trying to use import.io to clear some football scores. I managed to get their JS to work with the API and deliver the data. The problem is that it must be in a closed space inside the controller, since I cannot execute ng-repeat on it.
Can someone tell me why, and also if someone has a good guide to the area, which is likely to be more helpful.
latestScores.controller('ScoresController', function ($scope) { $scope.pots = []; var io2 = new importio("XXX", "XXXXXX[API KEY]XXXXXXXX", "import.io"); io2.connect(function (connected) { if (!connected) { console.error("Unable to connect"); return; } var data; var callback = function (finished, message) { if (message.type == "DISCONNECT") { console.error("The query was cancelled as the client was disconnected"); } if (message.type == "MESSAGE") { if (message.data.hasOwnProperty("errorType")) { console.error("Got an error!", message.data); } else { data = message.data.results; } } if (finished) { pots = data; console.log(pots); } } io2.query({ "connectorGuids": [ "d5796d7e-186d-40a5-9603-95569ef6cbb9"], }, callback); }); console.log($scope.pots); });
source share