propertyChanged in Au2

In Au1 there was a hook called “propertyChanged()” to react to changes of bound properties.

export class MyComponent {
   @bindable
   prop1: string;
   @bindable
   prop2: string;
   @bindable
   prop3: string;
   @bindable
   prop4: string;

   propertyChanged() {
       // is called when any of the props changes
   }
}

Is there something similar in Au2?

I think this is what you’re looking for: Observing property changes with @observable - The Aurelia 2 Docs

Or maybe Watching data - The Aurelia 2 Docs

Thank you, @davidsk!

The callback of @observable is what I’m looking for!

1 Like

Also just so you know, the xChanged still exist but there was a breaking change in Au2 which is that it isn’t called on the initial component initialization while it was in Au1. See this Au2 doc