Home Ask Login Register

Developers Planet

Your answer is one click away!

Saqib Ali February 2016

How can I construct an AngularJS state parameter in the view by concatenation?

Using the AngularJD ui-router, I have defined a state myState that takes 3 parameters: stateParam1, stateParam2 and stateParam3.

In my view the variables var1 and var2 are already defined. I pass them in as stateParam1 and stateParam2 respectively. That works. But for stateParam3, I want to send in the concatenation of the first two fields. But how do I do it? How can I concatenate var1 and var2 into a third variable that I send in as stateParam3?

<a ui-sref="myState({'stateParam1': var1, 'stateParam2': var2, 'stateParam3': WHAT_GOES_HERE? })">


Pankaj Parkar February 2016

It would be simple string concatenation of those variables like var1 + var2

ui-sref="myState({'stateParam1': var1, 'stateParam2': var2, 'stateParam3': var1 + var2 })">

Post Status

Asked in February 2016
Viewed 1,157 times
Voted 7
Answered 1 times


Leave an answer

Quote of the day: live life