This is my code
$http.get("/Student/GetStudentById?studentId=" + $scope.studentId + "&collegeId=" + $scope.collegeId) .then(function (result) { }); In the above code use http service for get student details based on id. but i want to write the above service string.format like in c#.net
(eg:- string.format("/Student/GetStudentById/{0}/collegeId/{1}",studentId,collegeId)
encodeURIComponent. In your particular case a converter from a JavaScript object like{studentId: $scope.studentId, collegeId: $scope.collegeId}to a properly encoded series of query parameters is the best plan.