My AngularJS application is working perfectly in Firefox but not in Internet Explorer(9). The form validation is done using $dirty.
$scope.hasError = function(field, validation){
if(validation){
return ($scope.myForm[field].$dirty && $scope.myForm[field].$error[validation]) || ($scope.submitted && $scope.myForm[field].$error[validation]);
}
return ($scope.myForm[field].$dirty && $scope.myForm[field].$invalid) || ($scope.submitted && $scope.myForm[field].$invalid);
};
The issue I face in IE9 is that validation doesn't work and the console says
TypeError: Unable to get value of the property '$dirty': object is null or undefined.
What went wrong? Please help!