Skip to content

Instantly share code, notes, and snippets.

@mohamedaboelmagd
Forked from NetanelBasal/dirty-check-4.ts
Created March 13, 2022 08:33
Show Gist options
  • Save mohamedaboelmagd/a681e69e515cf3df2aaf19566094196e to your computer and use it in GitHub Desktop.
Save mohamedaboelmagd/a681e69e515cf3df2aaf19566094196e to your computer and use it in GitHub Desktop.
@Component({
template: `
<form>
...
<button (click)="submit()" *ngIf="isDirty$ | async">Save</button>
</form>
`
})
export class SettingsComponent {
settings = new FormGroup({...});
isDirty$: Observable<boolean>;
ngOnInit() {
this.isDirty$ = this.settings.valueChanges.pipe(
dirtyCheck(store$),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment