Re-set All Forms To Pristine Status From The Bottom Up
We have smDateTimePicker directive which is rather complex. This time picker control can be part of another directive and that directive can be placed into the form (or a tab). In
Solution 1:
See if this works for you. You may have to do minor changes if needed:
DateTimePicker.prototype.setPristine = function () {
if (this.form) {
setPristineToForm(this.form);
}
};
// Recursive method - goes up the hierarchy of forms
var setPristineToForm = function (form) {
if (form) {
//Check if a parent form exists. If it does, set parent's pristine
var parentForm = this.form.$$parentForm;
if (parentForm) {
setPristineToForm(parentForm);
}
else { //No parent exist. Set pristine to current form if it is dirty.
if (form.$dirty)
form.$setPristine();
}
}
};
Post a Comment for "Re-set All Forms To Pristine Status From The Bottom Up"