當我使用console.log(_router.url)
時,無法獲取網址。它只返回/
(斜槓)Angular 2 - 無法從路由器獲取網址
當我做下面的代碼:
constructor(
private el: ElementRef,
private _auth:AuthenticationService,
@Inject(AppStore) private store: Store<AppState>,
private _router:Router,
) {
console.log(_router);
console.log(_router.url);
}
時(...),結果被點擊它顯示"/languages"
但是當我console.log(_router.url)
這只是它打印
你得到這個解決。答案似乎不適合我。 – Hiran