2017-05-04 19 views

回答

1

當您的Angular應用程序啓動時,您的請求已停用。所以你不能在這裏解析你的標題。

我建議你更喜歡您在Godaddy的添加請求PARAM託管應用程序的請求,然後用@angular/router這樣分析它的角度成分:

import {Router, ActivatedRoute, Params} from '@angular/router'; 
import {OnInit, OnDestroy, Component} from '@angular/core'; 

@Component({...}) 
export class YourComponent implements OnInit { 

    constructor(private activatedRoute: ActivatedRoute) {} 

    ngOnInit() { 
    this.activatedRoute.params.subscribe((params: Params) => { 
     let origin= params['origin']; 
     console.log(origin); 
     }); 
    } 

} 

或者,你可以解析請求PARAM在頁面加載時使用純Javascript(location.search ...)。

如果您無法編輯Godaddy託管的應用程序請求,則必須在服務於您的Angular應用程序的服務器上配置反向代理。

+0

正是我在找什麼,謝謝卡波斯! – Kevin192291

相關問題