title: Passing Json array to custom directive Angular 5
body: <p>I am using angular 5. I want to pass a json array to the custom directive.</p>
  
  <p>My code:</p>
  
  <p>product.ts</p>
  
  <pre><code>products=[{"laptop":"dell", id:1}, {"laptop":"lenovo", id:2}];
  </code></pre>
  
  <p>product.html</p>
  
  <pre><code>&lt;div product-data="{{data}}" *ngFor="let data of products"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>product-data.ts</p>
  
  <pre><code>@Directive({
    selector: '[product-data]'
  })
  export class ProductDetailsDirective {
      @Input('template-thumbnail') productSelected:any;
  
      ngAfterViewInit() {
        console.log(this.productSelected)
      }
  }
  </code></pre>
  
  <p>on logging the productSelected  i am getting a string <strong>[object Object]</strong> instead of an array </p>
  
  <p>Any help would be greatly appreciated.</p>