Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help with component resolve (update to 1.0) #2976

Closed
Luddinus opened this issue Sep 6, 2016 · 1 comment
Closed

Help with component resolve (update to 1.0) #2976

Luddinus opened this issue Sep 6, 2016 · 1 comment
Labels

Comments

@Luddinus
Copy link

Luddinus commented Sep 6, 2016

Edit: Does not work with named ui-views? http://jsfiddle.net/789Ks/96/

Hi,

I'm using version 0.3.1 of angular-ui-router

I have a userProfile component and this works fine:

// some state definition
url: '/{user}',
abstract: true,
views: {
    'content@': {
        resolve: {
            qCurrentUser: (Manager, $stateParams) => {
                // internally $http promise
                return Manager.users().show($stateParams.user);
            }
        },
        template: '<user-profile user="$resolve.qCurrentUser.data"></user-profile>',
    }
}

The component has "user" binding, and I can access in the component's controller using "this.user".

The problem is that I'm trying to use the same behaviour with 1.0 but it is not working. (I'm using "template" option because "component" didn't work.)

What am I missing?

Thx.

@christopherthielen
Copy link
Contributor

resolve is a property of a state, not a property of a view.
Move the resolve to the state level and it works: http://jsfiddle.net/789Ks/97/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants