Calling a Factory in AngularJS

Posted by Kohjah Breese on Stack Overflow See other posts from Stack Overflow or by Kohjah Breese
Published on 2014-08-23T03:50:09Z Indexed on 2014/08/23 4:20 UTC
Read the original article Hit count: 130

Filed under:
|

How do you call a factory? As defined below.

angular.module('fb.services', []).factory('getQueryString', function () {
    return {
        call: function () {
            var result = {}, queryString = qs.substring(1),
                re = /([^&=]+)=([^&]*)/g,
                m;
            while (m = re.exec(queryString))
            result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
            return result;
        }
    }
});
alert(getQueryString.call('this=that&me=you'));

© Stack Overflow or respective owner

Related posts about angularjs

Related posts about factory