Sven Ya Sven Ya - 1 year ago 176
AngularJS Question

Passing $ parameters using ng-href

Something really weird happens in my current code.

So I'm using

to create several elements based on an array of objects like this:

<a ng-repeat="report in reports" ng-href="#/report?report={{}}+file=0" ></a>

My rendered HTML looks as far as I can tell correctly like this:

<a ng-repeat="report in reports" ng-href="#/report?report=81+file=0"
class="ng-scope" href="#/report?report=81+file=0">

If I now click on this link I am redirected to a url like this:


When I actually of course want to be here:


Why is the "
" and the second "
" sign translated this way, when it is correct in the links-href-attribute? Anybody had this same problem? Any idea what I am doing wrong?

Answer Source

It is being URL encoded. It still has the same value.

Currently, you only have one parameter keyed report with a value of 84 file=0. The plus sign in this case means a space.

I'm assuming you wanted to have two parameters: report and file. To split parameters in a URL you have to use the ampersand symbol (&) instead of the plus sign.

<a ng-repeat="report in reports" ng-href="#/report?report={{}}&file=0" ></a>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download