in Ionic by
How do you pass data from one view to another in Ionic applications?

1 Answer

0 votes
Ionic v.1 uses AngularJS and UI-router. It means you can use Angular services or UI-router’s state resolve to pass data from one view to another. Since Angular services are singletons, data stored in services can be accessed across other Angular controllers.

As mentioned, UI-router provides a resolve configuration. For example:


  .state('todos', {

    url: '/todos',

    controller: 'TodosCtrl',

    templateUrl: 'todos.html',

    resolve: {

      todos: function(TodosService) {

        return TodosService.getTodos()




One advantage of resolve over stateful services is better testing: as resolve injects dependencies in the controller, it is easy to test them.

When using Ionic v.4 you have 3 options:

Using Query Params (bad)

Service and Resolve Function (legit)

Using Router Extras State (new since Angular 7.2)

 openDetailsWithState() {

    let navigationExtras: NavigationExtras = {

      state: {

        user: this.user



    this.router.navigate(['details'], navigationExtras);

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
asked May 14, 2020 in MVC Language by sharadyadav1986
0 votes
asked Oct 16, 2019 in Design Patterns by DavidAnderson