angular-soap
angular-soap copied to clipboard
Differences in array return vs singular item
@andrewmcgivery right. So one thing I have discovered is that when returning a singular the soapclient puts the result inside the data.item property and when returning an array it's an array.
easier to explain with code.
var $soap = this.$injector.get("$soap");
$soap.post(endpoint, "method_name", {})
.then(function (data) {
if (typeof (data.item) !== "undefined") {
// There's only 1 version!
versions = [data.item];
}
else {
versions = data;
}
I'm not sure if it's better documenting this different in behaviour between array results and singular results or standardising the result in the angular-soap wrapper?
Eric.