Wednesday, 1 June 2016

31. Angularjs Page refresh issue


Anjularjs routes can be opened in othertabs also not problem, as well reload/refresh the page also not casues any issues


<head>
    <title></title>
    <base href="/" />
    <link href="Styles/Styles.css" rel="stylesheet" />
    <script src="Scripts/angular.js"></script>
    <script src="Scripts/angular-route.js"></script>
    <script src="Scripts/RoutingScript.js"></script> 
   
</head>

web.config

<system.webServer>
    <rewrite>
      <rules>
        <rule name="AngularJS" enabled="true" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
          </conditions>
          <action type="Rewrite" url="/index.html" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>

No comments:

Post a Comment