2017-10-10 35 views
0

我在IIS 8上託管角色2+應用程序。所有路由都是客戶端路由,除了以/mutual-funds/*開頭的某些路由。對於那些路由,我想讓IIS獲得該文件夾並使用其索引頁。我已經寫了重寫規則,但它不能在重新加載。任何幫助,將不勝感激。Angular 2+應用程序IIS託管路線在重新加載時不起作用

的網絡配置文件是:

<rule name="AngularJS Routes" stopProcessing="false"> 
     <match url=".*" /> 
     <conditions logicalGrouping="MatchAll"> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="/webapp/" /> 
    </rule> 





    <rule name="Check1" stopProcessing="false"> 
     <match url="/mutual-funds/"/> 
     <conditions logicalGrouping="MatchAll"> 
     <add input="{ REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     </conditions> 
     <action type="Rewrite" url="/webapp/mutual-funds/" /> 
    </rule> 

回答

0

我有興趣,如果有人有響應。

RouterModule.forRoot(routes, {useHash: true}) 

它會在網址後面添加「#」:

作爲一種變通方法,您可以在您提供的路由器使用哈希定位策略加入{ useHash: true }。然後,你可以用URL http://your-context/#mutual-funds

這裏訪問你的網頁有關位置策略GOOT文章:https://codecraft.tv/courses/angular/routing/routing-strategies/

+0

我不想使用HashLocationStratgey。 –

相關問題