다른 서비스를 호출하는 해당 매개 변수를 기반으로 URL의 param을 확인합니다. Chrome/Mozilla/Edge에서는 예상대로 작동하지만 IE11에서는 작동하지 않습니다. 지속적으로 동일한 페이지로 리디렉션됩니다.각도 4 Observable이 IE11에서 작동하지 않습니다.
http://localhost/oauth/?code=xxxxxx
그리고 여기는 제 구성 요소 코드입니다.
ngOnInit() {
this.sub = this.route.queryParams.subscribe(params => {
if (params['code']) {
this.loginProcess = 'Hold tight! Authentication in progress.';
this.authenticationService.getOADAccessToken(params['code']).subscribe(function(res){
// some code
});
else {
// redirect to login page
}
그것은 심지어 그 호출 getOADAccessToken 서비스 호출 후, PARAM 코드 값을 얻고있다. 그러나 서비스 콜백에서 돌아 오기 전에 그 부분을 else
부분으로 다시 호출하고 동일한 페이지를 다시로드하고, param 코드를 받고 서비스를 호출하고 다시로드합니다.
service.ts
getOADAccessToken(token): Observable<any> {
return this.http.post(environment.API + '/getAccessTokens',
{ code: token })
.map((response: Response) => {
const ADResult = response.json();
return response.json();
});
}
그것은 IE10/(11)를 제외한 모든 브라우저에서 일하고있어. 모든 폴리 필을 polyfill.ts
에 활성화했습니다. 사용 설정 Intl
.
I 모바일 사용하고 그래서 잘 모르겠어요하지만'if' 문 하하 닫는 중괄호'} @Adrian' – Adrian
부족, 다른 줄을 제거했습니다. '}'원래 코드 –