Prechádzať zdrojové kódy

#87: filter out keys with empty values

Davide Alberani 8 rokov pred
rodič
commit
06de357aae
1 zmenil súbory, kde vykonal 8 pridanie a 0 odobranie
  1. 8 0
      angular_app/js/services.js

+ 8 - 0
angular_app/js/services.js

@@ -25,6 +25,14 @@ eventManServices.factory('Event', ['$resource',
                     if (data && data['end-datetime']) {
                         data['end-date'] = data['end-date'].getTime();
                     }
+                    // strip empty keys.
+                    angular.forEach(data.persons || [], function(person, person_idx) {
+                        angular.forEach(person, function(value, key) {
+                            if (value === "") {
+                                delete person[key];
+                            }
+                        });
+                    });
                     return data;
                 }
             },