2017-12-28 1 views
2

JSON 파일에서 데이터를 가져옵니다.2 각도의 json 파일의 최종 수정 날짜를 얻는 방법

나는 마지막으로 그 JSON 파일

private _url = 'http://localhost:54362/app/output.json'; 
this.http.get(this._url) 
        .toPromise() 
        .then((response) => { 
         this.jsonData = response.json(); 
        }).catch((err) => { 
         console.log(err); 
        }); 

는 어떻게과 lastModified 날짜를 얻을 수있는 방법 내가 JSON 파일에서 데이터를 가져 오는하고 여기에

의 날짜를 수정하려는 ??

편집 :이 같은 얻고 헤더에서

...

console.log(response.headers._headers) 


Map {"date" => ["Thu, 28 Dec 2017 08:29:15 GMT"], "etag" => [""8b6668d5a47fd31:0""], "last-modified" => ["Thu, 28 Dec 2017 06:26:45 GMT"], "server" => ["Microsoft-IIS/10.0"], "x-powered-by" => ["ASP.NET"]…} 

방법이에서 마지막으로 수정 한 날짜에 액세스 할 수 ???

+1

https://stackoverflow.com/questions/45505619/angular-4-3-3-httpclient-how-get-value-from -the-head-of-a-response는 응답 헤더를 읽는 데 도움이됩니다. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified –

+0

귀하의 의견에 따라 게시물을 편집하여주십시오. – Aarsh

답변

1

이 당신에게 헤더에서 마지막으로 수정 한 날짜를 제공해야

response.headers.get('last-modified') 
+1

도움을 주셔서 감사합니다! – Aarsh

관련 문제