ㅇ the way to get rid of # from url
http://localhost:8080/#/centers
=>
http://localhost:8080/centers
add line in app.js
$locationProvider.html5Mode(true).hashPrefix('!');
ㅇ Other problem #1 involed in html5Mode
When you access the page with url directly like below, then you'll get 404 error.
http://localhost:8080/centers
=> Need to solve it in server setting for that.
1. Devide the servlet for the direct call url service from other request.
<servlet-mapping>
<servlet-name>restful</servlet-name>
<url-pattern>/rest/*</url-pattern> => for other request
</servlet-mapping>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/page/*</url-pattern> => for direct web page call service
</servlet-mapping>
2. Add url mapping to servlet configuration file (ex. dispatcher-servlet.xm)
<mvc:view-controller path="/page/centers" view-name="index" />
ㅇ Other problem #2 involed in html5Mode
When the direct call url has parameter, then you'll get 404 error.
http://localhost:8080/page/regions/1
<mvc:view-controller path="/page/regions" view-name="index" /> => doesn't work
Need to deal with that problem in Controller like this.
@RequestMapping(value = "/regions/{id}", method = RequestMethod.GET)
public String regionsIndex(){
return "index";
}
cf. apache setting solution
http://stackoverflow.com/questions/17444072/angularjs-cant-get-html5-mode-urls-with-ui-route-state
Comments
Post a Comment