**how can we dynamically bind the property of child component to the html page of parent component in angular2?**
**Component property binding
父组件应该能够动态访问html页面中的子组件**属性 Parentcomponent.ts 为父级{ ngOnInit(){
call child component method
} }
**Here the value must be binded**
parentcomponent.html
"here how to bind items of childcomponent through parentcomponent "
ex: i want the value like {{items.name}}
and it has to change dynamically when value in childcomponent changes
**This is child component whixh will get the value of the** item.name from service and bind it to the html of parent component
childcomponent.ts
ChildComponent{
items:any;(Item is json object with properties item id,item name etc)
ngOnInit(){
this.items=Itemsservice.getItems();
}
}
**This is the service method.**
itemservice.ts
@Injectable()
export class ItemService{
getItems(){
return items;
}