UNPKG

@spalger/kibana

Version:

Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic

20 lines (18 loc) 570 B
define(function (require) { var module = require('ui/modules').get('kibana'); module.directive('autoSelectIfOnlyOne', function ($parse) { return { restrict: 'A', require: 'ngModel', link: function (scope, element, attributes, ngModelCtrl) { attributes.$observe('autoSelectIfOnlyOne', function (result) { var options = $parse(result)(scope); if (options && options.length === 1) { ngModelCtrl.$setViewValue(options[0]); ngModelCtrl.$render(); } }); } }; }); });