O'Reilly logo

Ionic Cookbook by Hoc Phan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Communication between a view, controller, and directive using events

One of the most confusing aspects of using Ionic is when and how to leverage eventing for communication between various components. Let's take a look at the various scenarios and different ways to handle the data flow:

  • State to view and/or controller: This is handled by UI-Router. There are several options. You can use the resolve object declared at the route level and pass it to the controller just as a factory. Another option is to pass data as a parameter in $stateParams so that the controller for that specific state can receive data.
  • View to view: To share data in different views, store them in a parent scope, $stateParams, or factory. If it's just a simple piece of data, mainly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required