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

Report
Question
5 views

Please explain why do you think this question should be reported?

Report Cancel

Ionic uses AngularJS and UI-router. It implies you can utilize Angular services or UI-router’s state make plans to pass data starting with one view then onto the next. Since Angular services are singletons, information put away in services can be gotten to crosswise over other Angular controllers.
As specified, UI-router gives a resolve configuration. For Example: $stateProvider
.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.

Please follow and like us:

About the Author