Refactor angularjs maven archetype to support html5 uris
Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/f150c9f2 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/f150c9f2 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/f150c9f2 Branch: refs/heads/develop Commit: f150c9f295f41cbbddf122005c469dd7a935e233 Parents: e3682f9 Author: Johannes Geppert <joh...@gmail.com> Authored: Fri May 1 12:59:46 2015 +0200 Committer: Johannes Geppert <joh...@gmail.com> Committed: Fri May 1 12:59:46 2015 +0200 ---------------------------------------------------------------------- .../src/main/webapp/WEB-INF/content/hello.jsp | 5 ++++- .../archetype-resources/src/main/webapp/js/bootstrap.js | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/f150c9f2/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp index 703353e..d66b06a 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp @@ -5,13 +5,16 @@ <head> <meta charset="utf-8"> <title>My AngularJS Struts2 App</title> + + <s:url var="ctxUrl" forceAddSchemeHostAndPort="true" includeContext="true" value="/" namespace="/" ></s:url> + <base href="<s:property value="ctxUrl"/>"> </head> <body> <h2><s:property value="message"/></h2> <div> - <a href="#/home">Home</a> - <a href="#/projects">Projects</a> + <a href="/home">Home</a> - <a href="/projects">Projects</a> </div> <div ng-controller="AppController"> http://git-wip-us.apache.org/repos/asf/struts/blob/f150c9f2/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js index 501427f..beefd53 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/bootstrap.js @@ -21,8 +21,11 @@ var angularStrutsApp = angular.module('angularStrutsApp', ['ngRoute']); -angularStrutsApp.config(['$routeProvider', - function($routeProvider) { +angularStrutsApp.config(['$routeProvider', '$locationProvider', + function($routeProvider, $locationProvider) { + + $locationProvider.html5Mode(true).hashPrefix('!'); + $routeProvider.when('/projects', { templateUrl: 'partials/projects.html', controller: 'ApacheProjectsController'