Page 1 of 1

Calling global ("app") datasource functions in ionic5

Posted: Fri Jun 04, 2021 2:32 pm
by czambrano

Hello,

In my ionic5/angular application I use the same data in several pages, in bootstrap/angularjs I created functions in index to retrieve and stored the info in global variables accessible in other pages using $scope.$parent.$parent.varName.

I know in ionic5/angular I can create global datasource services in "app" and store data using the ionic storage tool, but I am not sure how I can call this global functions, read and display the global variables from other pages. In the events menu I only can invoke services created on the page i'm working on. Could you please guide me on this


Re: Calling global ("app") datasource functions in ionic5

Posted: Sat Jun 05, 2021 6:29 pm
by Serhii Kulibaba

Hello,

Please place all common functions to the custom service (Create new->TypeScript->Angular Service) you will get a sample code on how to use it. After that you can add this service on any page you need (in the tab code->Internal includes) and define a variable, based on that include.