title: Detect change in child component's variable triggered by parent angular 2
body: <p>I have 2 files. app.ts and Child.ts</p>
  
  <p>I am sending a variable from app to child and I want to detect any change in the variable and show data accordingly. I am not able to detect changes in a variable.</p>
  
  <p>Any Help? I have attached Plunker Link and I have also explained what I want to do in Child.ts file in comments</p>
  
  <p><strong>App.ts File</strong></p>
  
  <pre class="lang-ts prettyprint-override"><code>//our root app component
  import {Component, NgModule} from '@angular/core'
  import {BrowserModule} from '@angular/platform-browser'
  import {ChildCom} from './child.ts'
  
  @Component({
      selector: 'my-app',
      template: `
      &lt;div&gt;
          &lt;h2&gt;Hello&lt;/h2&gt;
          &lt;child-com newdata={{data}}&gt;&lt;/child-com&gt;
      &lt;/div&gt;
      `,
  })
  export class App {
      data: any = [];
  
        constructor(){
            this.data = [{"name":"control","status":"false"}];
      }
  }
  
  @NgModule({
      imports: [ BrowserModule ],
      declarations: [ App, ChildCom ],
      bootstrap: [ App ]
  })
  export class AppModule {}
  </code></pre>
  
  <p><strong>Child.ts File</strong></p>
  
  <pre class="lang-ts prettyprint-override"><code>import {Component, Input} from '@angular/core';
  
  @Component({
    selector: 'child-com',
    template: `
      &lt;div&gt;
        &lt;p&gt;Controls: {{newdata}}&lt;/p&gt;
      &lt;/div&gt;
    `,
  })
  
  export class ChildCom {
    @Input() newdata: any = [];
  
    constructor(){
    }
  
    // here I want to check if the value of control in newdata variable is false 
    // then display a message on the front end "your controls are not working"
    // if the value of control in newdata variable is true
    // then display a message on front end "your controls are working fine."
    // this should automatically happen whenever I change the value of newdata variable
  }
  </code></pre>
  
  <p><a href="https://plnkr.co/edit/BMylrA16SK7CErZSHIvc?p=preview" rel="nofollow noreferrer">Plunker Link</a></p>