Before I am using JQuery and I use this to send URL with parameter
window.location = myUrl + $.param({"paramName" : "ok","anotherParam":"hello"});
but with angularjS this does not work the same way
$scope.myButton = function() {
$window.location.open = myUrl + $.param({"paramName" : "ok","anotherParam":"hello"});
};//Error: $ is not defined
can anyone help me how to do this in angularJs
I found this function useful for url serialization. Will also work for nested objects.
There's a built-in serializer in angular which mimics $.param(): $httpParamSerializerJQLike
AngularJs has jquery lite on its core so you can use angular.element.param() instead of $.param()
If you are trying to create serialized representation of data like $.param() does,
and use this for your data serialization
you can inject and use this function instead: $httpParamSerializerJQLike()
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.