summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Weidinger <alexwegoo@gmail.com>2017-04-18 11:06:12 +0200
committerAlexander Weidinger <alexwegoo@gmail.com>2017-04-18 13:09:39 +0200
commit07495356fd8b7e6ad56d969adf953a85bec7cf4d (patch)
tree36ff63a08153438d10d166f4e07c6ef446e0d041
parent87006b585e88ab6a24e573405cfd98c325119262 (diff)
Differentiate between string and array in categories function.
-rw-r--r--js/models/contact_model.js7
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'));