search

Home  >  Q&A  >  body text

angular.js - How to pass multiple parameters through url in angularjs?

HTML:

<a ng-click="onGoDetail(y.id);"><img ng-src="imgurl/1.jpg" /></a>

JS:

$scope.onGotDetail=function(pNo)
    {
      window.location.href="detail.html?pNo="+pNo;
    };

URL such as http://1.1.1.1/report.html?pNo=123 Using this method, you can pass the pNo=123 parameter on a url to the destination page while jumping to the page, but what if you want to pass multiple parameters at once? For example, there are 2 parameters, one id and one key. How to write the HTML page? How to write js page? I have just come into contact with angularjs, so I would like to ask my seniors for guidance.

世界只因有你世界只因有你2775 days ago661

reply all(1)I'll reply

  • 大家讲道理

    大家讲道理2017-05-15 16:53:25

    Introduction.
    If you pass multiple parameters, just spell multiple parameters:

    window.location.href="detail.html?id="+id+"&key="+key;
    

    Of course, since you use angular, just use angular$location,

    See also: $location

    reply
    0
  • Cancelreply