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 70ca934f7..70cdb1412 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
@@ -1,7 +1,7 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
-
+
My AngularJS Struts2 App
@@ -15,12 +15,13 @@
">
+">
+">
">
">
-">
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 4daa73536..8983318b3 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
@@ -18,16 +18,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-angular.module('angularstruts', [], function ($routeProvider) {
- $routeProvider.when('/projects', {
- templateUrl: '/partials/projects.html',
- controller: ApacheProjectsController
- }).when('/home', {
- templateUrl: '/partials/home.html',
- controller: HomeController
- }).otherwise({ redirectTo: '/home' });
-});
-angular.element(document).ready(function () {
- angular.bootstrap(document, ['angularstruts']);
-});
+var angularStrutsApp = angular.module('angularStrutsApp', ['ngRoute']);
+
+angularStrutsApp.config(['$routeProvider',
+ function($routeProvider) {
+ $routeProvider.when('/projects', {
+ templateUrl: '/partials/projects.html',
+ controller: 'ApacheProjectsController'
+ }).when('/home', {
+ templateUrl: '/partials/home.html',
+ controller: 'HomeController'
+ }).otherwise({ redirectTo: '/home' });
+ }
+]);
diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
index b6d698ed9..01afe21cf 100644
--- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
+++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
@@ -18,25 +18,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-function AppController($scope) { }
-AppController.$inject = ['$scope'];
+angularStrutsApp.controller('AppController', function ($scope) { });
-function HomeController($scope) {
+angularStrutsApp.controller('HomeController', function ($scope) {
$scope.name = "Sunshine";
-}
-HomeController.$inject = ['$scope'];
+});
-function ApacheProjectsController($scope, $http) {
+angularStrutsApp.controller('ApacheProjectsController', function ($scope, $http) {
this.init = function() {
$http({method: 'GET', url: '/projects'}).
- success(function(data) {
- $scope.projects = data.projectNames;
- }).
- error(function(data, status, headers, config) {
- alert("Could not receive project names");
- });
+ success(function(data) {
+ $scope.projects = data.projectNames;
+ }).
+ error(function(data, status, headers, config) {
+ alert("Could not receive project names");
+ });
};
this.init();
-}
-ApacheProjectsController.$inject = ['$scope', '$http'];
\ No newline at end of file
+});