I have an "Angular2" component "ItemBoard" which is a container of "Item" components. I need to get cart data by remote service first and use it to create Items. I would like to know which lifecycle method in ItemBoard should be used for this action?
ngOnChanges()
ngOnInit()
ngDoCheck()
@Component(selector: '[itemBoard]', templateUrl: "itemBoard.html", directives: const [Item], viewProviders: const [CartService])
class ItemBoard {
List cartItems= [];
ItemBoard(){}
}
@Component(selector: '[item]', templateUrl: "item.html", directives: const [Item])
class ItemBoard {
@Input() List cartItems;
}