I am striving to replicate some of the features found in Angular 1.3.X for the app I am developing, with a particular focus on ensuring compatibility with IE 8. Unfortunately, this constraint means that I cannot utilize version 1.3.X. I have encountered difficulties while attempting to reproduce the functionality of the $ng-touched attribute available in 1.3.X.
One crucial aspect of our application is notifying users if their form element is invalid after tabbing through it. Currently, the $invalid attribute is not set on any form elements unless text has been entered and then deleted. I experimented with utilizing $pristine and $dirty in order to trigger $invalid after tabbing, but both appear to be dependent on the value of the input rather than whether it has been touched (which may have been a key advantage of 1.3.X).
Objective: trigger validations when a user tabs through a form and mark each empty form element as $invalid if it is blank. Essentially, aiming to emulate the behavior of the $ng-touched attribute in 1.2.X. Here is the code snippet I have developed so far:
angular.module('goodStewardApp')
.directive('chf-validate', function () {
return {
require: 'ngModel',
link: function(scope, elm, attrs, ctrl) {
$(elm).blur(
function(elm) {
ctrl.$setValidity(elm, false);
}
);
}
};
});
Any assistance on this matter would be highly appreciated. Thank you!