Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 3219b4d

Browse files
committed
Breaking Change rename ValidationService issue #107
- new 1.5.x branch has a breaking change, which is the fix of the uppercase on ValidationService object (instead of validationService which was wrong has mentioned in issue #107). - added angular-validation-ghiscoding to NPM and fixed the .npmignore
1 parent f68943e commit 3219b4d

File tree

24 files changed

+114
-106
lines changed

24 files changed

+114
-106
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#################
2+
## bower Package
3+
#################
4+
bower_components/
5+
16
#################
27
## NPM Package
38
#################

.npmignore

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
full-tests
2-
more-examples
3-
protractor
4-
templates
1+
bower_components/
2+
full-tests/
3+
more-examples/
4+
protractor/
5+
templates/
56
.gitignore
6-
app.js
7+
app.js
8+
gulpfile.js
9+
index.html

app.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ myApp.controller('Ctrl', ['$location', '$route', '$scope', '$translate', functio
3838

3939
// -- Controller to use Angular-Validation Directive
4040
// -----------------------------------------------
41-
myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'validationService', function ($q, $scope, validationService) {
41+
myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'ValidationService', function ($q, $scope, ValidationService) {
4242
// you can change default debounce globally
4343
$scope.$validationOptions = { debounce: 1500, preValidateFormElements: false };
4444

@@ -49,13 +49,13 @@ myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'validationService'
4949
// remove a single element ($scope.form1, string)
5050
// OR you can also remove multiple elements through an array type .removeValidator($scope.form1, ['input2','input3'])
5151
$scope.removeInputValidator = function ( elmName ) {
52-
new validationService().removeValidator($scope.form1, elmName);
52+
new ValidationService().removeValidator($scope.form1, elmName);
5353
};
5454
$scope.resetForm = function() {
55-
new validationService().resetForm($scope.form1);
55+
new ValidationService().resetForm($scope.form1);
5656
};
5757
$scope.submitForm = function() {
58-
if(new validationService().checkFormValidity($scope.form1)) {
58+
if(new ValidationService().checkFormValidity($scope.form1)) {
5959
alert('All good, proceed with submit...');
6060
}
6161
}
@@ -83,11 +83,11 @@ myApp.controller('CtrlValidationDirective', ['$q', '$scope', 'validationService'
8383
// -- Controller to use Angular-Validation Directive with 2 forms
8484
// on this page we will pre-validate the form and show all errors on page load
8585
// ---------------------------------------------------------------
86-
myApp.controller('Ctrl2forms', ['validationService', function (validationService) {
86+
myApp.controller('Ctrl2forms', ['ValidationService', function (ValidationService) {
8787
var vm = this; // use the ControllerAs alias syntax
8888

8989
// 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 });
9191

9292
vm.submitForm = function() {
9393
if(myValidationService.checkFormValidity(vm.form01)) {
@@ -106,9 +106,9 @@ myApp.controller('Ctrl2forms', ['validationService', function (validationService
106106
// -----------------------------------------------
107107

108108
// 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) {
110110
// start by creating the service
111-
var myValidation = new validationService();
111+
var myValidation = new ValidationService();
112112

113113
// you can create indepent call to the validation service
114114
// also below the multiple properties available
@@ -183,7 +183,7 @@ myApp.controller('CtrlValidationService', ['$q', '$scope', '$translate', 'valida
183183

184184
// -- Controller to use Angular-Validation with Directive and ngRepeat
185185
// ---------------------------------------------------------------
186-
myApp.controller('CtrlNgRepeat', ['$scope', 'validationService', function ($scope, validationService) {
186+
myApp.controller('CtrlNgRepeat', ['$scope', 'ValidationService', function ($scope, ValidationService) {
187187
// Form data
188188
$scope.people = [
189189
{ name: 'John', age: 20 },
@@ -192,7 +192,7 @@ myApp.controller('CtrlNgRepeat', ['$scope', 'validationService', function ($scop
192192
];
193193

194194
$scope.submitForm = function() {
195-
if(new validationService().checkFormValidity($scope.form01)) {
195+
if(new ValidationService().checkFormValidity($scope.form01)) {
196196
alert('All good, proceed with submit...');
197197
}
198198
}

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-validation-ghiscoding",
3-
"version": "1.4.22",
3+
"version": "1.5.0",
44
"author": "Ghislain B.",
55
"description": "Angular-Validation Directive and Service (ghiscoding)",
66
"main": [

dist/angular-validation.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

full-tests/app.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ myApp.controller('Ctrl', ['$location', '$route', '$scope', '$translate', functio
3838

3939
// -- Controller to use Angular-Validation with Directive
4040
// -------------------------------------------------------
41-
myApp.controller('CtrlValidationDirective', ['$scope', '$translate', 'validationService', function ($scope, $translate, validationService) {
41+
myApp.controller('CtrlValidationDirective', ['$scope', '$translate', 'ValidationService', function ($scope, $translate, ValidationService) {
4242
$scope.$validationOptions = { debounce: 50 }; // set the debounce globally with very small time for faster Protactor sendKeys()
4343

4444
$scope.switchLanguage = function (key) {
@@ -49,7 +49,7 @@ myApp.controller('CtrlValidationDirective', ['$scope', '$translate', 'validation
4949
$scope.validations = explodeAndFlattenValidatorArray(validatorDataset);
5050

5151
$scope.submitForm = function() {
52-
if(new validationService().checkFormValidity($scope.form01)) {
52+
if(new ValidationService().checkFormValidity($scope.form01)) {
5353
alert('All good, proceed with submit...');
5454
}
5555
}
@@ -60,12 +60,12 @@ myApp.controller('CtrlValidationDirective', ['$scope', '$translate', 'validation
6060

6161
// -- Controller to use Angular-Validation with Service
6262
// -------------------------------------------------------
63-
myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationService', function ($scope, $translate, validationService) {
63+
myApp.controller('CtrlValidationService', ['$scope', '$translate', 'ValidationService', function ($scope, $translate, ValidationService) {
6464
var validatorDataset = loadData();
6565
$scope.validations = explodeAndFlattenValidatorArray(validatorDataset);
6666

6767
// start by creating the service
68-
var myValidation = new validationService();
68+
var myValidation = new ValidationService();
6969
myValidation.setGlobalOptions({ debounce: 50, scope: $scope })
7070

7171
for(var i = 0, ln = $scope.validations.length; i < ln; i++) {
@@ -80,7 +80,7 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
8080
};
8181

8282
$scope.submitForm = function() {
83-
if(new validationService().checkFormValidity($scope.form01)) {
83+
if(new ValidationService().checkFormValidity($scope.form01)) {
8484
alert('All good, proceed with submit...');
8585
}
8686
}

more-examples/addon-3rdParty/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ myApp.config(['$compileProvider', function ($compileProvider) {
1515
$translateProvider.preferredLanguage('en').fallbackLanguage('en');
1616
}]);
1717

18-
myApp.controller('Ctrl', ['validationService', function (validationService) {
18+
myApp.controller('Ctrl', ['ValidationService', function (ValidationService) {
1919
var vm = this;
20-
var myValidation = new validationService({ controllerAs: vm, formName: 'vm.test', preValidateFormElements: false });
20+
var myValidation = new ValidationService({ controllerAs: vm, formName: 'vm.test', preValidateFormElements: false });
2121

2222
vm.tags1 = [
2323
{ id: 1, text: 'Tag1' },

more-examples/angular-ui-calendar/app.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ myApp.config(['$compileProvider', function ($compileProvider) {
1515
}]);
1616

1717
myApp.controller('Ctrl',
18-
['$scope', '$translate', 'validationService', '$timeout',
19-
function ($scope, $translate, validationService, $timeout) {
18+
['$scope', '$translate', 'ValidationService', '$timeout',
19+
function ($scope, $translate, ValidationService, $timeout) {
2020
var vm = this;
2121
vm.model = {};
2222
vm.validationRequired = false;
@@ -37,8 +37,8 @@ function ($scope, $translate, validationService, $timeout) {
3737
vm.isChangeDatePickerOpen = true;
3838
};
3939

40-
var validation = new validationService({
41-
controllerAs: vm,
40+
var validation = new ValidationService({
41+
controllerAs: vm,
4242
preValidateFormElements: false
4343
});
4444

more-examples/controllerAsWithRoute/app.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,27 @@ myApp.config(['$compileProvider', function ($compileProvider) {
4545
}]);
4646

4747
myApp.controller('Ctrl', [
48-
'validationService',
49-
function (validationService) {
48+
'ValidationService',
49+
function (ValidationService) {
5050
var vm = this;
5151
vm.model = {};
52-
var v1 = new validationService({ controllerAs: vm, resetGlobalOptionsOnRouteChange: false });
52+
var v1 = new ValidationService({ controllerAs: vm, resetGlobalOptionsOnRouteChange: false });
5353
}]);
5454

5555
myApp.controller('FirstCtrl', [
56-
'validationService',
57-
function (validationService) {
56+
'ValidationService',
57+
function (ValidationService) {
5858
var vm = this;
5959
vm.model = {};
60-
var v2 = new validationService({ controllerAs: vm });
60+
var v2 = new ValidationService({ controllerAs: vm });
6161
}
6262
]);
6363

6464
myApp.controller('SecondCtrl', [
65-
'validationService',
66-
function (validationService) {
65+
'ValidationService',
66+
function (ValidationService) {
6767
var vm = this;
6868
vm.model = {};
69-
var v3 = new validationService({ controllerAs: vm });
69+
var v3 = new ValidationService({ controllerAs: vm });
7070
}
7171
]);

more-examples/customRemote/app.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ myApp.config(['$compileProvider', function ($compileProvider) {
1818

1919
// --
2020
// Directive
21-
myApp.controller('CtrlDirective', ['$q', 'validationService', function ($q, validationService) {
21+
myApp.controller('CtrlDirective', ['$q', 'ValidationService', function ($q, ValidationService) {
2222
var vmd = this;
2323
vmd.model = {};
2424

25-
// use the validationService only to declare the controllerAs syntax
26-
var vs = new validationService({ controllerAs: vmd, debounce: 500 });
25+
// use the ValidationService only to declare the controllerAs syntax
26+
var vs = new ValidationService({ controllerAs: vmd, debounce: 500 });
2727

2828
vmd.myRemoteValidation1 = function() {
2929
var deferred = $q.defer();
@@ -54,12 +54,12 @@ myApp.controller('CtrlDirective', ['$q', 'validationService', function ($q, vali
5454

5555
// --
5656
// Service
57-
myApp.controller('CtrlService', ['$scope', '$q', 'validationService', function ($scope, $q, validationService) {
57+
myApp.controller('CtrlService', ['$scope', '$q', 'ValidationService', function ($scope, $q, ValidationService) {
5858
var vms = this;
5959
vms.model = {};
6060

61-
// use the validationService only to declare the controllerAs syntax
62-
var vs = new validationService({ controllerAs: vms, debounce: 500 });
61+
// use the ValidationService only to declare the controllerAs syntax
62+
var vs = new ValidationService({ controllerAs: vms, debounce: 500 });
6363

6464
vs.setGlobalOptions({ scope: $scope })
6565
.addValidator('input3', 'alpha|min_len:2|remote:vms.myRemoteValidation3():alt=Alternate error message.|required')
@@ -86,7 +86,7 @@ myApp.controller('CtrlService', ['$scope', '$q', 'validationService', function (
8686
}
8787

8888
vms.submitForm = function() {
89-
if(new validationService().checkFormValidity(vms.form2)) {
89+
if(new ValidationService().checkFormValidity(vms.form2)) {
9090
alert('All good, proceed with submit...');
9191
}
9292
}

0 commit comments

Comments
 (0)