Angular & HTML / check if element is dirty

Viewed 7964

I have the following code in my HTML page:

<input type="text" name="dns" class="form-control ng-valid" ng-model="conf['dns']" ng-list="">

When I type something in the text field, its changed to:

<input type="text" name="dns" class="form-control ng-valid ng-dirty" ng-model="conf['dns']" ng-list="">

I wish to check if the field its dirty, and do some acts if so. I have the following:

Controller.controller('CuController',
    function($scope, $location, $modal, Controller) {
    console.log($scope.conf['dns']) //prints the value of this field
    // Wish to check if $scope.conf['dns'] is dirty
})

I try to use $scope.conf[dns].$dirty, but it returns undefined.

How can I check if the field is dirty (Meaning that the value of the field was changed)?

2 Answers
Related