2
xml 파일이있는 url에 http GET 요청을하고 있는데 응답 헤더 'Content-Lenght'을 가져와야합니까? 가져올 방법이 있습니까? 파일을 다운로드하기 전에 파일의 크기를 확인해야합니다. 로 형질 전환 응답 본문 - | {오브젝트 문자열} -angularjs - 콘텐츠 길이 헤더를 얻을 수있는 방법
여기 각도 문서에서 내 코드
$http({
method : "GET",
url : "http://url/file.xml"
}).then(function mySucces(data) {
console.log(response);
$scope.content = response.data;
}, function myError(error) {
console.log(error);
$scope.content = error.statusText;
});
이 헤더는 이것은 나를 위해 작동하지 않는 기능 –
아니라고 말한다 'Content-Length'헤더. 귀하의 예제는 'Content-Type'을 보여 주지만 'Content-Length'를 요청하면 'null'만 반환됩니다. 나는 여전히 이것을 'Content-Length'로 작동시키는 방법을 찾지 못했다. – jkjustjoshing
@jkjustjoshing 시도해 보셨습니까? http://stackoverflow.com/questions/38190998/angularjs-get-headers-in-response –