Sha256: 12a357ed7e498eaefc3f276f65acaf0909faccd44ba0f1df8beaef720434e0ab

Contents?: true

Size: 711 Bytes

Versions: 6

Compression:

Stored size: 711 Bytes

Contents

define([
  'angular',
  'app',
  'lodash'
],
function (angular, app, _) {
  'use strict';

  angular
    .module('kibana.directives')
    .directive('arrayJoin', function() {
      return {
        restrict: 'A',
        require: 'ngModel',
        link: function(scope, element, attr, ngModel) {

          function split_array(text) {
            return (text || '').split(',');
          }

          function join_array(text) {
            if(_.isArray(text)) {
              return (text || '').join(',');
            } else {
              return text;
            }
          }

          ngModel.$parsers.push(split_array);
          ngModel.$formatters.push(join_array);
        }
      };
    });
});

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kibana-sinatra-3.1.2.0 lib/kibana/assets/app/directives/arrayJoin.js
kibana-sinatra-3.1.1.0 lib/kibana/assets/app/directives/arrayJoin.js
kibana-sinatra-3.1.0.2 lib/kibana/assets/app/directives/arrayJoin.js
kibana-sinatra-3.1.0.1 lib/kibana/assets/app/directives/arrayJoin.js
kibana-sinatra-3.1.0.0 lib/kibana/assets/app/directives/arrayJoin.js
kibana-sinatra-3.0.1.0 lib/kibana/assets/app/directives/arrayJoin.js