I have a table of settings (e.g., check boxes) on a form and the user has the ability to add and remove table rows. theForm.$dirty
gets set if the user changes a setting (e.g., checks or unchecks a check box) but not if a row is added to or removed from the table. I have an example at https://plnkr.co/edit/sOXFnZjpkrcExvxGsEVg
I'm a relatively new Angular developer but I've been cautioned that it is not a best practice to reference $scope
if one can avoid it. I think that in this case, I could make the controller depend on $scope
then invoke $scope.theForm.$setDirty()
in the functions which modify the table. I'm not sure if that is my only recourse or if there's a better approach.
Just put form to controller:
form name="vm.testForm"
But there is nothing bad if controller depends on scope.