How to get and pass data from login page to home page and display the data?


#1

Hi, I’m relatively new to Nativescript so please bear with me :slight_smile:

So basically the registered user’s data (e.g. Name,ID,Password) is stored in the sqlite database. after they log in I want to get their input data(ID) from the login page and pass it to the home page so that I can query the given data and display user’s data in a Label as text.

How do I pass data between two pages and displaying it after querying from the database? I’m using JS only.

Thanks!


#2

First it’s all JavaScript, The easiest way is to keep a singleton ViewModel (Observable) which you may require in any page and use, update data etc.,

Optionally you may pass bindingContext / context when you navigate between pages.

Docs: https://docs.nativescript.org/core-concepts/navigation#navigate-and-pass-context


#3

I am looking for something similar. Am using nativescript with angular.


#4
  1. Use Services to hold data
  2. The fun way is using ngrx