EnriqueMark
Angular

SimpleChanges

2026-04 English

This is a class made for recording Input changes in a child component, usually paired with ngOnChanges and passed into the method as an argument. Inside it are nested key-value pairs, property name to SimpleChange (note the missing s). The structure is below.

// the structure of SimpleChange
{
  previousValue: any,   // the value before the change
  currentValue: any,    // the value after the change
  firstChange: boolean  // whether this is the first change (initialization)
}

Inside the method you can call changes['propName'] directly to get whether that property changed. Only a property that actually changed has a SimpleChange, and if it comes back empty, that means it didn’t change. So if you want to pull the value out of it, check that it exists first, to avoid a null pointer.


Translation note. I wrote this in Chinese. This English version is an LLM translation, so the wording is not mine even though the thinking is. Original: SimpleChanges.