title: Angular 2 - Can we bind JSON object directly from typescript file to html input value?
body: <p>I have the following code in my .ts file.</p>
  
  <pre><code>yourInfoData: IYourInfoData; //IYourInfoData is my constructor
  
  getYourInfoData() {
    $this = this;
    $this.yourInfoData = yourInfoDataResponse; //yourInfoDataResponseis my response from service.
  }
  </code></pre>
  
  <p>yourInfoDataResponsestructure is as follows:</p>
  
  <pre><code>yourInfoDataResponse{
    "firstName" : "Xyz",
    "lastName" : "Abc"
  }
  </code></pre>
  
  <p>Can I access this.yourInfoData directly to bind with html input value as below : </p>
  
  <pre><code>&lt;input type="text" [(ngModel)]="yourInfoData.firstName"&gt;
  </code></pre>
  
  <p>Doing so, I am getting an error </p>
  
  <blockquote>
    <p>Cannot find firstName of undefined.</p>
  </blockquote>
  
  <p>Can someone point to me what am I missing here. Or, is there other way to achieve this.</p>