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

Commit 26281c2

Browse files
authored
fix Cannot read property 'indexOf' of undefined
The `.rules` property could be an empty string in which case the code dies because it uses `self.validatorAttrs.validation` which could be undefined, therefore the `.indexOf` check fails. This fixes TypeError: Cannot read property 'indexOf' of undefined.
1 parent b6c3799 commit 26281c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/validation-common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ angular
178178
self = analyzeElementAttributes(self);
179179

180180
// get the rules(or validation), inside directive it's named (validation), inside service(rules)
181-
var rules = self.validatorAttrs.rules || self.validatorAttrs.validation;
181+
var rules = self.validatorAttrs.hasOwnProperty('rules') ? self.validatorAttrs.rules : self.validatorAttrs.validation;
182182

183183
// We first need to see if the validation holds a custom user regex, if it does then deal with it first
184184
// So why deal with it separately? Because a Regex might hold pipe '|' and so we don't want to mix it with our regular validation pipe

0 commit comments

Comments
 (0)