When my form loads initially the $pristine property is always false. It was my understanding that as long as there's no user interaction with the form that the $pristine property will be true until the user changes the model via some kind of interaction. Is there anything else that I need to be aware that could set the $pristine property to false without the user manually changing the model? I'm trying to alert the user that there are unsaved changes before they close the form if it's not pristine.
1 Answer
The problem ended up being the use of the Select2 angularjs directive. There's a known bug that causes the form to be dirty on initialization. There's currently an open issue on github that covers this problem. Issue Here
form.$pristine === true: plnkr.co/edit/mPTSfly5juSYi5RmcMwi?p=preview$dirtyis always!$pristine. Your comment is misleading$pristinewhen it loads. Something else is going on, so you need to edit your question and show more code