Skip to content

breeze-client / hasChanges$

Function: hasChanges$() ​

hasChanges$(em): Observable<boolean>

Defined in: src/rxjs/breeze-rxjs.ts:82

Whether em has unsaved changes, as an Observable that starts with the current value.

EntityManager.hasChangesChanged only fires on a change, so on its own it cannot tell a late subscriber what the answer is now. This emits em.hasChanges() as soon as it is subscribed to, then each change after that, and never the same value twice in a row. Bind a Save button to it and the button is right from the first render.

ts
hasChanges$(em).subscribe(dirty => saveButton.disabled = !dirty);

The current value is read when you subscribe, not when you call this function.

Parameters ​

em ​

EntityManager

Returns ​

Observable<boolean>

Released under the MIT License.