forked from ghiscoding/angular-validation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
30 lines (25 loc) · 879 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
var myApp = angular.module('myApp', ['ngRoute', 'pascalprecht.translate', 'ghiscoding.validation']);
myApp.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.when('/validate', {
templateUrl: 'templates/testingForm.html',
controller: 'Ctrl'
});
$routeProvider.otherwise({
redirectTo: 'validate',
});
}])
.config(['$translateProvider', function ($translateProvider) {
$translateProvider.useStaticFilesLoader({
prefix: 'locales/validation/',
suffix: '.json'
});
// load English ('en') table on startup
$translateProvider.preferredLanguage('en');
}]);
myApp.controller('Ctrl', ['$scope', '$translate', function ($scope, $translate) {
$scope.form1 = {};
$scope.switchLanguage = function (key) {
$translate.use(key);
};
}]);