1

I have following code in config. I use ui-router

template: "<employee-info-component user='$resolve.user'></employee-info-component>",
      resolve: {
           user: function () {
                return 'hello!';
           }
      }

binding in component:

binding:{
    user: '<'
}

I can not reach $ctrl.user in controller of employee-info-component. What I am doing wrong?

2
  • 1
    the key of resolve will be injected in the controller of the route instead of instead of direct access in template, because it may be promise as well which is not resolved before template render cehck here github.com/angular-ui/ui-router/wiki Commented Dec 1, 2016 at 13:31
  • Thanks for answer! But what do you mean by before template render cehck here? Commented Dec 1, 2016 at 13:41

2 Answers 2

1

There is no binding property in component. There is only bindings property, where we can specify variables, that will be linked. So you just made mistake in syntax

Sign up to request clarification or add additional context in comments.

Comments

0

user should be used as a dependency in the controller and not in template. If you want, inject user to the controller and bind it to a scope variable and then use it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.