Convert $.param in angularjs

后端 未结 6 1649
梦如初夏
梦如初夏 2020-12-06 16:02

Before I am using JQuery and I use this to send URL with parameter

window.location = myUrl + $.param({\"paramName\" : \"ok\",\"anotherParam\":\"hello\"});
         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-06 16:30

    You can simply use $.param on the javascript object and pass it to either $resource or $http and it should work fine. One caveat though is ensure it is an object and not an array.

    var badParam = {'name':'john',...}; // contains more properties
    var goodParam = {name :'john',...}; // contains more properties
    

提交回复
热议问题