diff options
-rw-r--r-- | js/models/contact_model.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/js/models/contact_model.js b/js/models/contact_model.js index 53d0ab84..8eb9ca34 100644 --- a/js/models/contact_model.js +++ b/js/models/contact_model.js @@ -189,7 +189,12 @@ angular.module('contactsApp') categories: function(value) { if (angular.isDefined(value)) { // setter - return this.setProperty('categories', { value: value }); + if (angular.isString(value)) { + /* check for empty string */ + this.setProperty('categories', { value: !value.length ? [] : [value] }); + } else if (angular.isArray(value)) { + this.setProperty('categories', { value: value }); + } } else { // getter var property = this.validate('categories', this.getProperty('categories')); |