Можно ли и в хорошей форме повторно использовать одну и ту же фабрику данных в Angular?

смотрю на Angular 'Общая фабрика для CRUD (которую я сейчас предпочитаю использовать сервису):

app.factory('dataFactory', ['$http', function ($http) {
    var urlBase = '/odata/ContentTypes';

    // The _object_ defined in the factory is returned to the caller, rather than as with a service,
    // where the _function_ defined in the service is returned to the caller
    var dataFactory = {};

    dataFactory.getContentTypes = function () {
        var contentTypes = $http.get(urlBase);

        return contentTypes;
    };

    dataFactory.getContentType = function (id) {
        return $http.get(urlBase + '/' + id);
    };

    dataFactory.insertContentType = function (contentType) {
        return $http.post(urlBase, contentType);
    };

    dataFactory.updateContentType = function (contentType) {
        return $http.put(urlBase + '/' + contentType.ID, contentType);
    }

    dataFactory.deleteContentType = function (id) {
        return $http.delete(urlBase + '/' + id);
    }


    // to traverse navigation properties
    //dataFactory.getUserFromContentTypeId = function (id) {
    //    return $http.get(urlBase + '/' + id + '/user');
    //}


    //dataFactory.getOrders = function (id) {
    //    return $http.get(urlBase + '/' + id + '/orders');
    //};


    return dataFactory;

}]);

Для всех моих сущностей этот код будет примерно одинаковым. Можно ли внедрить имя объекта (или соответствующий путь RESTful), и если да, можно ли это рассматривать как частичный класс, где, если требуются дополнительные обещания (такие как обход навигационных свойств), они также могут быть внедрены?

Если это возможно сделать с Angular, может кто-нибудь опубликовать несколько примеров?

Ответы на вопрос(1)

Ваш ответ на вопрос