In AngularJS, what's the difference between ng-pristine and ng-dirty?

后端 未结 5 1964
臣服心动
臣服心动 2020-12-12 21:53

What are the differences between ng-pristine and ng-dirty? It seems you can have both to be true:

$scope.myForm.$prist         


        
5条回答
  •  青春惊慌失措
    2020-12-12 22:05

    Both directives obviously serve the same purpose, and though it seems that the decision of the angular team to include both interfere with the DRY principle and adds to the payload of the page, it still is rather practical to have them both around. It is easier to style your input elements as you have both .ng-pristine and .ng-dirty available for styling in your css files. I guess this was the primary reason for adding both directives.

提交回复
热议问题