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

Commit

Permalink
Fix issue where empty Form Controller was throwing an error
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed Jan 24, 2017
1 parent 6d99a53 commit 96bc98f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.5.15",
"version": "1.5.16",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": [
Expand Down
6 changes: 3 additions & 3 deletions dist/angular-validation.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ gulp.task('compress', ['clean'], function() {
.pipe(gulp.dest('dist'));
});

gulp.task('test', function() {
gulp.task('e2e', function() {
gulp.src(["./protractor/*_spec.js"])
.pipe(protractor({
configFile: "protractor/conf.js",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-validation-ghiscoding",
"version": "1.5.15",
"version": "1.5.16",
"author": "Ghislain B.",
"description": "Angular-Validation Directive and Service (ghiscoding)",
"main": "dist/angular-validation.min",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Angular Validation (Directive / Service)
`Version: 1.5.15`
`Version: 1.5.16`
### Forms Validation with Angular made easy!
##### (Concept comes from the amazing Laravel)

Expand Down
5 changes: 4 additions & 1 deletion src/validation-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ angular
// also save it inside controllerAs form (if found)
if (!!form && !!form.$name) {
var formName = form.$name.indexOf('.') >= 0 ? form.$name.split('.')[1] : form.$name;
var ctrlForm = (!!_globalOptions.controllerAs[formName]) ? _globalOptions.controllerAs[formName] : self.elm.controller()[formName];
var ctrlForm = (!!_globalOptions.controllerAs && !!_globalOptions.controllerAs[formName])
? _globalOptions.controllerAs[formName]
: ((typeof self.elm.controller() !== "undefined") ? self.elm.controller()[formName] : null);

if(!!ctrlForm) {
ctrlForm.$validationSummary = arrayFindObjects(_validationSummary, 'formName', form.$name);
}
Expand Down

0 comments on commit 96bc98f

Please sign in to comment.