Skip to content

Resolve from child states cannot use parents resolved #102

Closed
@jmbarbier

Description

@jmbarbier

Parent resolved resources can be used in child controllers, but seems to be not available to child resolve :

app.config(function ($stateProvider) {
    $stateProvider.state('A', {
        template: "State A : {{resA.value}} <ui-view>",
        resolve: {
            resA: function () {
                return {
                    'value': 'A'
                };
            }
        },
        controller: function ($scope, resA) {
            $scope.resA = resA;
        }
    });
    $stateProvider.state('A.B', {
        template: ":: State A.B {{resB.value}} ",
        resolve: {
            resB: function (resA) {
                return {
                    'value': resA.value + '.B'
                };
            }
        },
        controller: function ($scope, resA, resB) {
            $scope.resB = resB;
            $scope.resAA = resA;
        }
    });
});

this raises an unknown provider resAProvider : http://jsfiddle.net/jmbarbier/6Qd4L/

this could be useful if possible to get resolved values available to child resolves..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions