22 * Angular-Validation Directive and Service (ghiscoding)
33 * http://github.com/ghiscoding/angular-validation
44 * @author : Ghislain B.
5- * @version : 1.5.20
5+ * @version : 1.5.21
66 * @license : MIT
7- * @build : Thu Apr 20 2017 12:18:09 GMT-0400 (Eastern Daylight Time)
7+ * @build : Sun May 14 2017 23:35:23 GMT-0400 (Eastern Daylight Time)
88 */
99/**
1010 * Angular-Validation Directive (ghiscoding)
@@ -949,7 +949,6 @@ angular
949949 var nbValid = 0 ;
950950 var validator ;
951951 var validatedObject = { } ;
952-
953952 // make an object to hold the message so that we can reuse the object by reference
954953 // in some of the validation check (for example "matching" and "remote")
955954 var validationElmObj = {
@@ -1720,7 +1719,9 @@ angular
17201719 var matchingCtrl = self . ctrl ; // keep reference of matching confirmation controller
17211720 var formElmMatchingObj = getFormElementByName ( self . ctrl . $name ) ;
17221721
1723- isValid = ( testCondition ( validator . condition , strValue , parentNgModelVal ) && ! ! strValue ) ;
1722+ isValid = ( ( ! validator . pattern || validator . pattern . toString ( ) === "/\\S+/" || ( ! ! rules && validator . pattern === "required" ) ) && strValue === null )
1723+ ? false
1724+ : ( testCondition ( validator . condition , strValue , parentNgModelVal ) && ! ! strValue ) ;
17241725
17251726 // if element to compare against has a friendlyName or if matching 2nd argument was passed, we will use that as a new friendlyName
17261727 // ex.: <input name='input1' friendly-name='Password1'/> :: we would use the friendlyName of 'Password1' not input1
@@ -1734,7 +1735,9 @@ angular
17341735
17351736 // Watch for the parent ngModel, if it change we need to re-validate the child (confirmation)
17361737 self . scope . $watch ( parentNgModel , function ( newVal , oldVal ) {
1737- var isWatchValid = testCondition ( matchingValidator . condition , matchingCtrl . $viewValue , newVal ) ;
1738+ var isWatchValid = ( ( ! validator . pattern || validator . pattern . toString ( ) === "/\\S+/" || ( ! ! rules && validator . pattern === "required" ) ) && strValue === null )
1739+ ? false
1740+ : ( testCondition ( validator . condition , strValue , parentNgModelVal ) && ! ! strValue ) ;
17381741
17391742 // only inspect on a parent input value change
17401743 if ( newVal !== oldVal ) {
0 commit comments