In my previous post , I was talking about how to implement events from Angular 1 in Angular 2. But in the snippet of code that I use as example we can find another thing that not exist in Angular 2: $watch .

I start defining the problem. We can have a directive or Angular 1 component like that:

If we want to migrate this code to Angular 2 we find a trouble: the new Angular don’t have scope , so it don’t have $watch . How we can watch a directive attribute? The solution is the set syntax from ES6.

The set syntax binds an object property to a function to be called when there is an attempt to set that property.

From MDN

So we can bind the input for a component to a function that do the same as the $watch function.