0
저는 Angular를 처음 사용합니다. 나는 스타 워즈 API를 사용하여 검색 페이지를 구현하려하지만 정의되지 않은 $ 범위를 얻으려고합니다. 여기서 뭘 잘못하고 있는지 잘 모르겠다.
'use strict';
var app = angular.module('starApp');
/* Application controller (for top-level auth) */
app.controller('SearchController', ['$location', 'AuthenticationService',
'$scope', '$http',
function($location, AuthenticationService, $scope, $http) {
console.log('*** SearchController ***');
$scope.items = [];
(function getData() {
var apiURL = "https://swapi.co/api/planets";
axios.get(apiURL).then(function(response) {
showDetail(response.data);
});
})();
function showDetail(data) {
$scope.items = data.results;
}
}]);
나는 $ scope을 내 컨트롤러에 주입하고 있지만 아직 정의되지 않은 것으로 나타났다.
당신이 각 라이브러리를 성공적으로 포함되어 있는지 있습니까? – Shubhranshu