Which one will I use for initializing data and why?
ngOnInit() { this.type = \'category\'; this.getData(); this.setData(); } ionViewDidLoad()
Both function works the same way, they get called when the view is initially loaded into the DOM.
Great blog about ionic2s lifecycle hooks here.