0
서버에 인증 할 모든 요청의 HTTP 헤더에 특수 값을 설정해야합니다.각도 설정 이미지로드시 헤더
나는 다음과 같은 코드가 있습니다 JSON에 대한
<img ng-if="content.image" src="{{img(content.image)}}">
및
var app = angular.module('myApp', []);
app.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.headers.common['Authorization'] = 'myKey';
}])
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://localhost:8080/myPath") .then(function(response) {
$scope.content = response.data;
});
모든 것이 잘 작동 요청을하지만 난 이미지와 strugle. 나에게 힌트가 있습니까? 'XMLHttpRequest의'에 'setRequestHeader를'을 실행하지 못했습니다 : 당신은`setRequestHeader를()`은`개방()`호출하기 전에, 는`catch되지 않은 InvalidStateError있을 것를 넣으면
와 그것을 해결 : 물체의 상태는 반드시 열려 있어야합니다 .' – webdevbyjoss