Title here
Summary here
prepareDatapreparedata is an asynchronous method that returns the data. Data will be binded later to the children. prepareData should only get the data and that’s all ! (forbidden to do anything with the children) (example below)
WRONG:
prepareData: function(context) {
this.categoryId = context.categoryId; // WRONG place
return this.vodService.getContents(context.categoryId)
.then((contents) => this.vodRail.setData(contents)); // WRONG place
}GOOD:
prepareData: function(context) {
return this.vodService.getContents(context.categoryId);
},
connectData: function(context) {
this.vodRail.setData(this.data); // GOOD place
this.categoryId = context.categoryId; // GOOD place
}connectDataprepareData to the view,states, focus etc…) in connectData. Use _getChildToFocus, beforeShow or onScreenReady. (example below)Do not play with views (states, focus…) in connectData:
WRONG:
connectData: function(context) {
this.vodRail.focus(); // WRONG place
}GOOD:
_getChildToFocus: function() {
return this.vodRail; // GOOD place
}