Calling global ("app") datasource functions in ionic5

Moderator: Support

czambrano
Posts: 3
Joined: Mon Nov 23, 2020 10:53 pm

Calling global ("app") datasource functions in ionic5

Post 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

Serhii Kulibaba
Posts: 144
Joined: Tue Aug 27, 2013 1:47 pm

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

Post 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.

Post Reply