I created a Home page with tabs using Ionic 3
and Angular
. The tabs are named Stats
and Calc
. When clicking on the Stats tab, it triggers the class/component stats.ts
(displayed below).
This component utilizes two providers: CropProvider
and ContractProvider
, which query the database and retrieve records. These providers work correctly on other pages and can successfully fetch data from SQLite DB. However, when accessed through the tabbed pages, I encounter the following error message.
Error:
Error: Uncaught (in promise): TypeError: Cannot read property 'length' of undefined
TypeError: Cannot read property 'length' of undefined
at StatsPage.webpackJsonp.168.StatsPage.buildStats (http://192.168.0.5:8100/build/main.js:707:51)
...
Stats.ts
... ... ...home.html
... ...home.ts
... ...Console Logs:
[app-scripts] [23:20:57] console.log: Into the stats page........
[app-scripts] [23:20:57] console.log: cropProvider: [object Object]
[app-scripts] [23:20:57] console.log: contractProvider: [object Object]
[app-scripts] [23:20:57] console.log: crops:undefined
[app-scripts] [23:20:57] console.log: contracts:undefined
I am unsure why I am facing this issue even after injecting them in the constructor. Any insights would be appreciated.