angular-ui / ui-router

The de-facto solution to flexible routing with nested views in AngularJS
http://ui-router.github.io/
MIT License
13.54k stars 3k forks source link

Child state not Inheriting resolved dependencies from parent state #3570

Closed sijintv closed 6 years ago

sijintv commented 6 years ago

Here is my code

$stateProvider
        .state('admin', {
            abstract: true,
            templateUrl: "views/common/content.html",
            resolve: {
                channel: function($stateParams){
                    return $stateParams.id
                }
            }
        })
        .state('admin.dash',{
            url: "/dash",
            templateUrl: "views/admin/admin_dash.html"
       })

and i have many controllers for this admin_dash.html view using ng-controller. And in any of these controllers (child) i am not able to inject 'channel' which is the resolved dependency of the parent state, which should be inherited. StackOverflow Question : https://stackoverflow.com/questions/47616637/child-state-not-inheriting-resolved-dependencies-from-parent-state

christopherthielen commented 6 years ago

Looks like your stackoverflow was answered. Only controllers that are "owned" by ui-router states are injected with resolve values.