InterviewSolution
Saved Bookmarks
| 1. |
What are the different ways to transfer data between Ionic Pages. |
|
Answer» For every mobile app, it is very ESSENTIALS to transfer its state between the components or pages. Ionic has few ways of doing it, which is listed below.
1. Base service @Injectable() export class BaseProvider { email:any; }2. Page A import { BaseProvider } from "YOUR_PATH"; @IonicPage() @Component({ selector: 'page-A', templateUrl: 'a.html', }) export class a { constructor(PRIVATE base: BaseProvider){ this.base.email = "test@test.com" } }3. Page B import { BaseProvider } from "YOUR_PATH"; @IonicPage() @Component({ selector: 'page-A', templateUrl: 'a.html', }) export class a { constructor(private base: BaseProvider){ console.log(this.base.email) //whatever set on page A can be accessed here } } |
|