Angular offers great possibilities for reading the status of an input field, like $dirty
, $touched
and so on. However, as far as I found out, that works only when accessing an input element by its name, like $scope.formName.inputFieldName
.
But I need to access an input element defined in a directive template inside the directive's controller by the element's ID (and without the form name). Whatever I try, I don't get the special input form handles. Something like
var myElement = $document[0].getElementById('my_id');
console.log(angular.element(myElement));
doesn't work. I get the DOM element itself, wrapped inside generic object context, but not the input handles Angular offers.