如何在angular2中将第一个URL动态设置为基本URL

如何在angular2中将第一个URL动态设置为基本URL,angular,angular2-routing,Angular,Angular2 Routing,我将angular2应用程序注入另一个应用程序分区,默认情况下,url包含一个大的查询字符串。如何将该url和查询字符串设置为angular2中的基本url exp url: http.example.com/this/thai?this=thhtyy&ttthh {provide: APP_BASE_HREF, useValue: '/'}, 这是因为您使用/作为基本URL。您可以将基本URL更改为您在代码中获得的第一个URL {provide: APP_BASE_HREF, u

我将angular2应用程序注入另一个应用程序分区,默认情况下,url包含一个大的查询字符串。如何将该url和查询字符串设置为angular2中的基本url

exp url: http.example.com/this/thai?this=thhtyy&ttthh


{provide: APP_BASE_HREF, useValue: '/'},

这是因为您使用/作为基本URL。您可以将基本URL更改为您在代码中获得的第一个URL

{provide: APP_BASE_HREF, useValue: window.document.location.href}

它解决了我的问题,但它试图在该url中找到我的静态内容和javascript文件。我希望我的静态内容应该保持原样。有什么想法吗?