@@ -38,7 +38,7 @@ myApp.controller('Ctrl', ['$location', '$route', '$scope', '$translate', functio
38
38
39
39
// -- Controller to use Angular-Validation Directive
40
40
// -----------------------------------------------
41
- myApp . controller ( 'CtrlValidationDirective' , [ '$q' , '$scope' , 'validationService ' , function ( $q , $scope , validationService ) {
41
+ myApp . controller ( 'CtrlValidationDirective' , [ '$q' , '$scope' , 'ValidationService ' , function ( $q , $scope , ValidationService ) {
42
42
// you can change default debounce globally
43
43
$scope . $validationOptions = { debounce : 1500 , preValidateFormElements : false } ;
44
44
@@ -49,13 +49,13 @@ myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'validationService'
49
49
// remove a single element ($scope.form1, string)
50
50
// OR you can also remove multiple elements through an array type .removeValidator($scope.form1, ['input2','input3'])
51
51
$scope . removeInputValidator = function ( elmName ) {
52
- new validationService ( ) . removeValidator ( $scope . form1 , elmName ) ;
52
+ new ValidationService ( ) . removeValidator ( $scope . form1 , elmName ) ;
53
53
} ;
54
54
$scope . resetForm = function ( ) {
55
- new validationService ( ) . resetForm ( $scope . form1 ) ;
55
+ new ValidationService ( ) . resetForm ( $scope . form1 ) ;
56
56
} ;
57
57
$scope . submitForm = function ( ) {
58
- if ( new validationService ( ) . checkFormValidity ( $scope . form1 ) ) {
58
+ if ( new ValidationService ( ) . checkFormValidity ( $scope . form1 ) ) {
59
59
alert ( 'All good, proceed with submit...' ) ;
60
60
}
61
61
}
@@ -83,11 +83,11 @@ myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'validationService'
83
83
// -- Controller to use Angular-Validation Directive with 2 forms
84
84
// on this page we will pre-validate the form and show all errors on page load
85
85
// ---------------------------------------------------------------
86
- myApp . controller ( 'Ctrl2forms' , [ 'validationService ' , function ( validationService ) {
86
+ myApp . controller ( 'Ctrl2forms' , [ 'ValidationService ' , function ( ValidationService ) {
87
87
var vm = this ; // use the ControllerAs alias syntax
88
88
89
89
// set the global options BEFORE any function declarations, we will prevalidate current form
90
- var myValidationService = new validationService ( { controllerAs : vm , debounce : 500 , preValidateFormElements : true } ) ;
90
+ var myValidationService = new ValidationService ( { controllerAs : vm , debounce : 500 , preValidateFormElements : true } ) ;
91
91
92
92
vm . submitForm = function ( ) {
93
93
if ( myValidationService . checkFormValidity ( vm . form01 ) ) {
@@ -106,9 +106,9 @@ myApp.controller('Ctrl2forms', ['validationService', function (validationService
106
106
// -----------------------------------------------
107
107
108
108
// exact same testing form used except that all validators are programmatically added inside controller via Angular-Validation Service
109
- myApp . controller ( 'CtrlValidationService' , [ '$q' , '$scope' , '$translate' , 'validationService ' , function ( $q , $scope , $translate , validationService ) {
109
+ myApp . controller ( 'CtrlValidationService' , [ '$q' , '$scope' , '$translate' , 'ValidationService ' , function ( $q , $scope , $translate , ValidationService ) {
110
110
// start by creating the service
111
- var myValidation = new validationService ( ) ;
111
+ var myValidation = new ValidationService ( ) ;
112
112
113
113
// you can create indepent call to the validation service
114
114
// also below the multiple properties available
@@ -183,7 +183,7 @@ myApp.controller('CtrlValidationService', ['$q', '$scope', '$translate', 'valida
183
183
184
184
// -- Controller to use Angular-Validation with Directive and ngRepeat
185
185
// ---------------------------------------------------------------
186
- myApp . controller ( 'CtrlNgRepeat' , [ '$scope' , 'validationService ' , function ( $scope , validationService ) {
186
+ myApp . controller ( 'CtrlNgRepeat' , [ '$scope' , 'ValidationService ' , function ( $scope , ValidationService ) {
187
187
// Form data
188
188
$scope . people = [
189
189
{ name : 'John' , age : 20 } ,
@@ -192,7 +192,7 @@ myApp.controller('CtrlNgRepeat', ['$scope', 'validationService', function ($scop
192
192
] ;
193
193
194
194
$scope . submitForm = function ( ) {
195
- if ( new validationService ( ) . checkFormValidity ( $scope . form01 ) ) {
195
+ if ( new ValidationService ( ) . checkFormValidity ( $scope . form01 ) ) {
196
196
alert ( 'All good, proceed with submit...' ) ;
197
197
}
198
198
}
0 commit comments