Skip to content

Instantly share code, notes, and snippets.

@JasonStoltz
Created January 8, 2015 17:56
Show Gist options
  • Save JasonStoltz/7365c8c35c1dbb84ffc8 to your computer and use it in GitHub Desktop.
Save JasonStoltz/7365c8c35c1dbb84ffc8 to your computer and use it in GitHub Desktop.

I call create to do an api query for cluster components.

api.post(path, data, angular.extend({
    transformRequest: [ pruneClusterComponent, prependClusterComponent ],
    transformResponse: [ extractClusterComponent ],
    initializer: configureClusterComponent,
    pathfinder: pathfinder
  }, config)

I now have a clusterComponent. I call $reload on that cluster component.

clusterComponent.$reload();

In epixa-resource here: https://github.com/epixa/epixa-resource/blob/master/src/resource.js#L120, the config it's trying to use is same config as it uses for the POST request:

{
  transformRequest: [ pruneClusterComponent, prependClusterComponent ],
  transformResponse: [ extractClusterComponent ],
  initializer: configureClusterComponent,
  pathfinder: pathfinder
}

This is a problem because it's trying to do a GET now ... so the same request transforms don't really apply. In this case, the pruneClusterComponent request transform actually bombs out, since there's no body apply the function to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment