struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [20/56] [abbrv] struts git commit: Adjust archetype to API changes of AngularJS version 1.2.x
Date Mon, 17 Nov 2014 10:48:23 GMT
Adjust archetype to API changes of AngularJS version 1.2.x


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/a16cedb2
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/a16cedb2
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/a16cedb2

Branch: refs/heads/master
Commit: a16cedb26e0e0e1fd0ae02ae245f5854c8c0a7ac
Parents: 387f802
Author: Johannes Geppert <johgep@gmail.com>
Authored: Sun Aug 31 13:54:33 2014 +0200
Committer: Johannes Geppert <johgep@gmail.com>
Committed: Sun Aug 31 13:54:33 2014 +0200

----------------------------------------------------------------------
 .../src/main/webapp/WEB-INF/content/hello.jsp   |  7 +++---
 .../src/main/webapp/js/bootstrap.js             | 25 ++++++++++----------
 .../src/main/webapp/js/controllers.js           | 25 +++++++++-----------
 3 files changed, 28 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/a16cedb2/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 70ca934..70cdb14 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 @@
 <!DOCTYPE html>
 <%@ page contentType="text/html; charset=UTF-8" %>
 <%@ taglib prefix="s" uri="/struts-tags" %>
-<html lang="en" ng-app="angularstruts">
+<html lang="en" ng-app="angularStrutsApp">
 <head>
     <meta charset="utf-8">
     <title>My AngularJS Struts2 App</title>
@@ -15,12 +15,13 @@
 </div>
 
 <div ng-controller="AppController">
-     <div ng-view></div>
+    <div ng-view></div>
 </div>
 
 <script src="<s:url value="js/lib/angular/angular.min.js" />"></script>
+<script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script>
+<script src="<s:url value="js/bootstrap.js" />"></script>
 <script src="<s:url value="js/directives.js" />"></script>
 <script src="<s:url value="js/controllers.js" />"></script>
-<script src="<s:url value="js/bootstrap.js" />"></script>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/struts/blob/a16cedb2/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 4daa735..8983318 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' });
+    }
+]);

http://git-wip-us.apache.org/repos/asf/struts/blob/a16cedb2/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/js/controllers.js
----------------------------------------------------------------------
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 b6d698e..01afe21 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
+});


Mime
View raw message