(myValue, otherValue)
| 10 | link: function(scope, elm, attrs, ctrl) { |
| 11 | |
| 12 | function validateEqual(myValue, otherValue) { |
| 13 | if (myValue === otherValue) { |
| 14 | ctrl.$setValidity('equal', true); |
| 15 | return myValue; |
| 16 | } else { |
| 17 | ctrl.$setValidity('equal', false); |
| 18 | return undefined; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | scope.$watch(attrs.validateEquals, function(otherModelValue) { |
| 23 | ctrl.$setValidity('equal', ctrl.$viewValue === otherModelValue); |