I'm using angular-ui ui-router for a web-app. I have a state/view configuration like this:
...
.state('parentState', {
url:'/:id',
views: {
'main@parent': {
controller: 'ParentMainCtrl',
},
'sub@parent': {
controller: 'ParentSubCtrl',
},
},
})
...
Now, I need to share data between the two states, main
and sub
. One way is to add a resolve
to parentState
and inject the dependency into the controllers of the views, but then I won't be able to do a data-binding between the two views. I tried adding a data
attribute to parentState
, but seems the children views do not inherit it. What would be a way to do a two-way data binding between the sibling views inside this state?