title: Angular 2.x watching for variable change
body: <p>I'm migrating from angular 1.x to 2.x but my brains still think in angular 1.x so sorry for silly questions.</p>
  
  <p>What I need is to take some action when one of my <strike>scope variables</strike> component properties changes. I found a solution but I think there should be better solution</p>
  
  <pre><code>export class MyApp {
      router: Router;
      location: Location;
      fixed: boolean = true;
  
      private set isFixed(value:boolean) {
          this.fixed = value;
  
          //TODO: look here
          console.log('isFixed changed', value);
      }
  
      private get isFixed():boolean {
          return this.fixed;
      }
  
      constructor(router: Router, location: Location) {
          this.router = router;
          this.location = location;
      }
  }
  </code></pre>
  
  <p>Look at the line <code>console.log('isFixed changed', value);</code> It's what I need and it's working. But I made it by declaring <code>getter</code> and <code>setter</code>, but isn't there a better solution to watch variables? Like in angular 1.x was <code>$scope.$watch</code>?</p>
  
  <p>I think my component code should look like</p>
  
  <pre><code>export class MyApp {
      router: Router;
      location: Location;
      isFixed: boolean = true;
  
      //TODO: $watch for isFixed change {
          console.log('isFixed changed', value);
      // }
  
      constructor(router: Router, location: Location) {
          this.router = router;
          this.location = location;
      }
  }
  </code></pre>