2016-09-21 46 views
0

如何,如果我要訪問angular2應用 頁面直接(沒有任何router-outlet指令)加載/路由角2(官方V2.0.0)

棘手的時刻到來時,應用程序必須在路由器應配置在iframe中打開。
所以iframe.src = localhost/PathParam1/PathParam2/ng2/page1

你有什麼想法,什麼URL_BASE_HREF應該是,或者我錯過了。

對於角以前的版本(所有RC6),URL_BASE_HREF是http://localhost/PathParam1/PathParam2/ng2

,然後路由工作。

現在,當我真的使用相同的邏輯,但如果我在

 
localhost/PathParam1/PathParam2/ng2/page1 

加載應用程序,然後它`自動更改爲

 
localhost/somePathParam/someOtherPathParam/ng2/PathParam1/PathParam2/ng2/page1 

你有任何想法,這是怎麼做完了?

在此先感謝

+0

它已經被解決了。我創建了一個小的lib,它提供了當前的基礎url。例如,如果我有'localhost/PathParam1/PathParam2/ng2/page1',該方法將返回'localhost/PathParam1/PathParam2/ng2',然後我有孩子導航到'page1' – Emilion

回答

0

它已經解決了。我創建了一個小的lib,它提供了當前的基礎url。例如,如果我有localhost/PathParam1/PathParam2/ng2/page1,該方法將返回localhost/PathParam1/PathParam2/ng2,然後我有孩子導航到page1