0

I amy trying to populate a ui-sref link with a parameter dynamicall:

ui-sref="business({id:{{business.busId}}})" 

But this does not work.

Any help would be appreciated!

4
  • Can you post the error you are getting? Commented Feb 27, 2017 at 16:06
  • 1
    Possible duplicate of How to pass parameters using ui-sref in ui-router to controller Commented Feb 27, 2017 at 16:07
  • Error: [$parse:ueoe] Unexpected end of expression: {id: Commented Feb 27, 2017 at 16:10
  • I don't think this is a duplicate. The issue is the formatting: Error: [$parse:ueoe] Unexpected end of expression: {id: Commented Feb 27, 2017 at 16:12

2 Answers 2

1

If you define your state like the following state definition:

.state('business', { parent: 'dashboard', url: '/business/{businessId}', controller: 'BusinessController as vm', templateUrl: 'business.html' }) 

Then you can call the state like <button ui-sref="business({businessId: business.id})"> Click me </button>

From the a controller you can call the state by calling $state like this: $state.go('business',{businessId: business.id});

You can read more about Using Parameters in Links here

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

Comments

0

Have you just tried:

ui-sref="business({id: business.busId})" 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.