From 8f97df85eefe4d648f2002b8d68818ef6020c2df Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Thu, 16 Jan 2014 11:57:55 +0000
Subject: [PATCH] #396 feature - Added i18n support to JS and HTML tags with AngularJS
---
securis/src/main/resources/static/js/main.js | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/securis/src/main/resources/static/js/main.js b/securis/src/main/resources/static/js/main.js
index ac9a886..8428bc3 100644
--- a/securis/src/main/resources/static/js/main.js
+++ b/securis/src/main/resources/static/js/main.js
@@ -1,22 +1,36 @@
(function() {
'use strict';
-
- var app = angular.module('app', ['ngRoute']);
- app.controller('PacksCtrl', ['$scope', '$http',
- function($scope, $http) {
-
+ var m = angular.module('securis', [ 'ngRoute', 'ngResource', 'toaster', 'localytics.directives', 'catalogs', 'i18n' ]);
+
+ m.config(function($routeProvider, $locationProvider) {
+ console.log('Configuring routes...');
+ $routeProvider.when('/login', {
+ templateUrl: 'login.html',
+ controller: 'LoginCtrl',
+ controllerAs: 'login'
+ });
+ $routeProvider.when('/licenses', {
+ templateUrl: 'licenses.html',
+ controller: 'LicensesCtrl',
+ controllerAs: 'licenses'
+ });
+ $routeProvider.when('/admin', {
+ templateUrl: 'admin.html',
+ controller: 'AdminCtrl',
+ controllerAs: 'admin'
+ });
+
+ // configure html5 to get links working on jsfiddle
+ $locationProvider.html5Mode(true);
+ });
+ m.controller('MainCtrl', ['$scope', '$location', '$L',
+ function($scope, $location, $L) {
+ console.log('Moving to login...');
+ console.log('Test 1 lang: ' + 'Hello {0}!! this is {1}'.$i18n('World', 'cool'));
+ console.log('Test 2 lang: ' + $L.get('Hello Pepe!!'));
+ $location.path('/login');
}]);
- app.controller('LicensesListCtrl', ['$scope', '$http',
- function($scope, $http) {
-
- }]);
-
- app.controller('LicenseCtrl', ['$scope', '$http',
- function($scope, $http) {
-
- }]);
-
})();
\ No newline at end of file
--
Gitblit v1.3.2