Ionic structural question


#1

Hi,
I am in the middle of trying to create an ionic app but am unsure if I am structuring it correctly. Essentially my app is going to be set up so that the user clicks a FAB to read a barcode. Based on this relevant data is then going to be pulled from a Firebase database and is going to be presented to the user.

The app is based on tabs (one for images, one for videos and one for general information). To make the barcode button available to all of the tabs I have added a header, toolbar and FAB to the app.component.js / app.html files, with the firebase data to be presented on the 3 tabs.

I decided to create a provider to handle the database work which the app.component.js will access to pass in the relevant barcodeID, the provider will then grab the data from firebase and store it in a FireBaseObservable. The 3 tabs will also access the provider to subscribe to the observable to display the relevant images/information.

Does that seem like the sensible solution? the reason I am asking is that the tabs do not seem to update the information when a new barcode is read. I know the data is being extracted from Firebase but the observable data on the tabs is not updating from the provider. Or would it be better to just put the FAB and Firebase code into each of the tab pages directly?

Many thanks


#2

These are all about the same “thing” whose barcode was scanned?


#3

Hi,
Yeah each time a barcode is scanned it will load in different information etc relating to that thing. Then when that has been read the user scans in the next code and reads that data/watches that video and so on and so on.

Cheers