Skip to content

Instantly share code, notes, and snippets.

@alaindet
Created July 11, 2022 13:42
Show Gist options
  • Save alaindet/814779006a7fd397d34ba515cd0b9bf9 to your computer and use it in GitHub Desktop.
Save alaindet/814779006a7fd397d34ba515cd0b9bf9 to your computer and use it in GitHub Desktop.
Angular utilities
import { SimpleChange } from '@angular/core';
export function didInputChange(change?: SimpleChange): boolean {
if (!change) return false;
return change.firstChange || change.currentValue !== change.previousValue;
}
export function didInputsChange(changes: SimpleChange[]): boolean {
return changes.some(ch => didInputChange(ch));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment