MCPcopy
hub / github.com/mgonto/restangular / restangularizeElem

Function restangularizeElem

src/restangular.js:1026–1055  ·  view source on GitHub ↗
(parent, element, route, fromServer, collection, reqParams)

Source from the content-addressed store, hash-verified

1024 }
1025
1026 function restangularizeElem(parent, element, route, fromServer, collection, reqParams) {
1027 var elem = config.onBeforeElemRestangularized(element, false, route);
1028
1029 var localElem = restangularizeBase(parent, elem, route, reqParams, fromServer);
1030
1031 if (config.useCannonicalId) {
1032 localElem[config.restangularFields.cannonicalId] = config.getIdFromElem(localElem);
1033 }
1034
1035 if (collection) {
1036 localElem[config.restangularFields.getParentList] = function() {
1037 return collection;
1038 };
1039 }
1040
1041 localElem[config.restangularFields.restangularCollection] = false;
1042 localElem[config.restangularFields.get] = _.bind(getFunction, localElem);
1043 localElem[config.restangularFields.getList] = _.bind(fetchFunction, localElem);
1044 localElem[config.restangularFields.put] = _.bind(putFunction, localElem);
1045 localElem[config.restangularFields.post] = _.bind(postFunction, localElem);
1046 localElem[config.restangularFields.remove] = _.bind(deleteFunction, localElem);
1047 localElem[config.restangularFields.head] = _.bind(headFunction, localElem);
1048 localElem[config.restangularFields.trace] = _.bind(traceFunction, localElem);
1049 localElem[config.restangularFields.options] = _.bind(optionsFunction, localElem);
1050 localElem[config.restangularFields.patch] = _.bind(patchFunction, localElem);
1051 localElem[config.restangularFields.save] = _.bind(save, localElem);
1052
1053 addCustomOperation(localElem);
1054 return config.transformElem(localElem, false, route, service, true);
1055 }
1056
1057 function restangularizeCollection(parent, element, route, fromServer, reqParams) {
1058 var elem = config.onBeforeElemRestangularized(element, true, route);

Callers 5

oneFunction · 0.85
oneUrlFunction · 0.85
okCallbackFunction · 0.85

Calls 2

restangularizeBaseFunction · 0.85
addCustomOperationFunction · 0.85

Tested by

no test coverage detected