mcasimir / mobile-angular-ui

Angular.js Mobile UI Framework with Bootstrap 3
http://mobileangularui.com/
MIT License
2.87k stars 709 forks source link

ui-switch does not make form.$dirty or form.$pristine #423

Open dcolley opened 7 years ago

dcolley commented 7 years ago

Is this a feature or bug?

<form name="testForm" novalidate>

  <p>$dirty:{{testForm.$dirty}}</p>
  <p>$pristine:{{testForm.$pristine}}</p>
  <p>$touched:{{testForm.$touched}}</p>
  <p>
    <input type="text" name="param1" ng-model="param1" placeholder="some text">
  </p>
  <p>
    <input type="text" name="happy" ng-model="happy" placeholder="some text">
  </p>
  <ui-switch
    name="happy"
    ng-model="happy"></ui-switch>

</form>

image

You can see ui-switch has been changed to true, but the form is $pristine and not $dirty

bower.json

image PS: Note, I am NOT loading angular-material in index.html

dcolley commented 7 years ago

This is my work-around:


  <ui-switch
    name="happy"
    ng-model="happy"
    ng-click="testForm.$dirty=true"></ui-switch>