Answers for "url builder angularjs"

0

url builder angularjs

angular.module('util').factory('urlBuilder', function($httpParamSerializer) {
    function buildUrl(url, params) {
        var serializedParams = $httpParamSerializer(params);

        if (serializedParams.length > 0) {
            url += ((url.indexOf('?') === -1) ? '?' : '&') + serializedParams;
        }

        return url;
    }

    return buildUrl;
});
Posted by: Guest on June-23-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language