Angular Repository Pattern
<p>I am trying to implement the Repository pattern in Angular, here is where I am at:</p>

<p>So, at the moment from my controller I will call my repository with </p>

<pre><code>RepositoryDataService.get(supplier_url, 1);
</code></pre>

<p>So I am always passing in supplier_url with each get, update etc</p>

<p>what I would like to do is new up a repository with the type name.  ie.</p>

<pre><code>var supplierRepo = new RepositoryDataService('suppliers');
var userRepo = new RepositoryDataService('users');

supplierRepo.get("babs").then(function(data){ supplier= data});
userRepo.get("peter").then(function(data){ user = data});

supplierRepo.update(id);
users.update(id);
</code></pre>

<p>This is my data service</p>

<pre><code>(function () {
"use strict";

RepositoryDataService.$inject = ['$http'];

angular.module('webclient.common.data').factory('RepositoryDataService', RepositoryDataService);

function RepositoryDataService($http) {
    var url = 'http://application/';

    var service = {
        get: get
    };

    return service;

    function get(controllerName,id) {
        var urlApi = url + controllerName + '/';

        if (typeof (id) !== "undefined" &amp;&amp; id !== null)
            return $http.get(urlApi + id)
                        .then(function (response) { return response.data; });
        else
            return $http.get(urlApi)
                        .then(function (response) { return response.data; });
    };

    };
}());
</code></pre>

<p>I don't want to use $resource, I would like to use $http</p>

<p>Thanks</p>