1.使用$watch进行表单监测:
$scope.$watch("fromName.$dirty", function (newValue) { $state.params.isDirty = newValue; });
2.表单提交成功后进行复位dirty:
$scope.formName.$setPristine(); $state.params.isDirty = false;