javascript - Angular does not run on an IIS server after removing the # symbol from the URL -


i developing web platform using angular js client side framework , .net server side framework creating rest webservices. now, goal remove # symbol. have followed these steps:

  1. configure $locationprovider , set html5mode true.
  2. add base tag index.html file (<base href="/">).
  3. configure iis server rewrite mode.

after completing these steps, # removed url , able navigate between routes angular not run correctly (for example: ng-show , ng-disabled directives , app's controllers not working).

i have tried add angular-csp.css index.html file , add ng-csp directive body tag problem persists.

is problem related client side configuration (some angular configs) or server side configuration (iis server configs) , how solve it?

edit

the project runs correctly on local node http server. have tested functionalities locally , no errors in browser's console.

so weird! solved problem , don't know how , why. have tried place javascript files in different folders , ended working app once placed them in js folder. locally, app works whether javascript files located in js folder or not. when things on iis server, found works when javascript files located in js folder. have searched lot reason nothing found.

edit:

finally, have found reason why app works when placed javascript files in js folder. actually, not js folder naming specifically, related config accepting specific folders naming , here web.config

<?xml version="1.0" encoding="utf-8"?> <configuration>     <system.webserver>         <rewrite>             <rules>                 <rule name="angular">                     <match url=".*\.html|css/|img/|fonts/|js/|data/|lib/|templates/|favicon.ico" negate="true" />                     <action type="rewrite" url="index.html" />                 </rule>             </rules>         </rewrite>      </system.webserver> </configuration> 

so if want answer myself: iis server side configuration (web.config). @ first putted javascript files in folder called "components" not listed between accepted url naming in web.config. result, server wouldn't allow access base_url/components , javascript files in components folder won't loaded in browser.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -