Trying to pass data to a child component, I can attach the property into the template, but cant seem to access the id inside the class of the component. Any ideas?
---PARENT---
<related-products [id]="product.id"></related-products>
--CHILD---
import {Component, OnInit, Input} from 'angular2/core';
import {RouteParams, Router} from 'angular2/router';
import {ProductService} from '../products/product.service.js';
@Component({
selector: 'related-products',
templateUrl: "wp-content/themes/f2/app/views/directives/related-products-template.html",
inputs: ['id'],
providers: [ProductService]
})
export class RelatedProductsComponent implements OnInit {
products: any[];
errorMessage: string;
id: number;
constructor(
private _service: ProductService,
private _router: Router,
private _routeParams: RouteParams
) {}
ngOnInit() {
console.log(this.id);
}
}