Skip to content

Instantly share code, notes, and snippets.

@nathanwoulfe
Created June 13, 2020 07:12
Show Gist options
  • Save nathanwoulfe/7e225ded78e25b2db6566fe10ed189f0 to your computer and use it in GitHub Desktop.
Save nathanwoulfe/7e225ded78e25b2db6566fe10ed189f0 to your computer and use it in GitHub Desktop.
How clean are my children?
this.workflowResource.saveNodeConfig(this.node.id, this.approvalPath, this.variant)
.then(() => {
this.notificationsService.success('SUCCESS', 'Workflow configuration updated');
this.$rootScope.$broadcast('configUpdated');
this.$scope.contentFlowForm.$setPristine();
// shouldn't need to do this...
// check that all child forms of the contentForm are pristine, then reset contentForm
let parentPristine = this.$scope.contentFlowForm.$$parentForm.$$controls
.filter(c => Object.prototype.hasOwnProperty.call(c, '$submitted'))
.every(x => x.$dirty === false);
if (parentPristine) {
this.$scope.contentFlowForm.$$parentForm.$setPristine();
}
}, err => this.notificationsService.error('ERROR', err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment