I have such routes:
.config(function config($stateProvider) {
$stateProvider.state('articles', {
url: '/articles',
views: {
main: {
controller: 'ArticlesCtrl',
templateUrl: 'actions/articles/articles.html'
}
}
})
.state('articles.edit', {
url: '/upd/:itemId',
views: {
'': {
templateUrl: 'actions/articles/articles.edit.html',
controller: 'ArticlesEditCtrl',
}
}
})
.state('articles.add', {
url: '/add/news/',
views: {
'': {
templateUrl: 'actions/articles/articles.add.html',
controller: 'ArticlesAddCtrl',
}
}
})
})
and i'm updating some data in articles
state, how can i force child controller with state articles.edit
to update it's $scope.someVar
with data from first state controller, without using services? Which way of solving this issue it the best one?
$broadcast
check dotnet-tricks.com/Tutorial/angularjs/…edit
andadd
. I this case you will be able to place common logic in "abstract" controller.