Explain me how do you pass data from one view to another in Ionic applications?
Submitted by: MuhammadIonic 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:
$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.
Submitted by: Muhammad
As mentioned, UI-router provides 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.
Submitted by: Muhammad
Read Online Hybrid Application Developer Job Interview Questions And Answers
Top Hybrid Application Developer Questions
☺ | How to render a 5000 item list in Ionic, without affecting scroll performance? |
☺ | Tell me in broad terms, how do you deploy an Ionic project onto a device? |
☺ | Tell us what do you need to develop in PhoneGap? |
☺ | How to architect PhoneGap applications? |
☺ | How to upgrade PhoneGap? |
Top Web Developer Categories
☺ | Bootstrap Interview Questions. |
☺ | Front End Web Developer Interview Questions. |
☺ | Typography Interview Questions. |
☺ | Laravel PHP Developer Interview Questions. |
☺ | Junior Developer PHP Interview Questions. |