Skip to content

Instantly share code, notes, and snippets.

@NetanelBasal
Created April 6, 2019 19:27
Show Gist options
  • Save NetanelBasal/4979f5bbfc2a77a0330d1fcd06241e62 to your computer and use it in GitHub Desktop.
Save NetanelBasal/4979f5bbfc2a77a0330d1fcd06241e62 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