Skip to content

Commit

Permalink
WW-4400 Replace outdated AngularJS version with latest stable Angular…
Browse files Browse the repository at this point in the history
…JS version
  • Loading branch information
jogep committed Aug 31, 2014
2 parents da2f2a5 + a16cedb commit b88c5d5
Show file tree
Hide file tree
Showing 324 changed files with 40,245 additions and 23,765 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="en" ng-app="angularstruts">
<html lang="en" ng-app="angularStrutsApp">
<head>
<meta charset="utf-8">
<title>My AngularJS Struts2 App</title>
Expand All @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
}
]);
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
});
Loading

0 comments on commit b88c5d5

Please sign in to comment.