url builder angularjs

Solutions on MaxInterview for url builder angularjs by the best coders in the world

showing results for - "url builder angularjs"
Max
03 Nov 2020
1angular.module('util').factory('urlBuilder', function($httpParamSerializer) {
2    function buildUrl(url, params) {
3        var serializedParams = $httpParamSerializer(params);
4
5        if (serializedParams.length > 0) {
6            url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams;
7        }
8
9        return url;
10    }
11
12    return buildUrl;
13});
14
queries leading to this page
url builder angularjsurl builder angularjs