LP#1708291: add a join filter for angular templates
authorJason Etheridge <jason@equinoxinitiative.org>
Tue, 30 May 2017 15:51:51 +0000 (11:51 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Fri, 4 Aug 2017 17:10:24 +0000 (13:10 -0400)
Signed-off-by: Jason Etheridge <jason@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/services/ui.js

index 5acf817..15ac788 100644 (file)
@@ -84,6 +84,18 @@ function($timeout , $parse) {
     };
 })
 
+// 'join' filter
+// TODO: perhaps this should live elsewhere
+.filter('join', function() {
+    return function(arr,sep) {
+        if (typeof arr == 'object' && arr.constructor == Array) {
+            return arr.join(sep || ',');
+        } else {
+            return '';
+        }
+    };
+})
+
 /**
  * Progress Dialog. 
  *