I have a js or angular problem. I don't know why I'm getting $parse isnt defined when I'm running this:
function link(scope, elem, attrs, ctrl) {
scope.$watch(function() {
var valid = $parse(attrs.fieldMatch)(scope) === ctrl.$modelValue;
ctrl.$setValidity('mismatch', valid);
});
}
function fieldMatch($parse) {
return {
restrict:'AE',
require: 'ngModel',
link: link
}
}
angular.module('fieldMatch', [])
.directive('fieldMatch', fieldMatch);