UNPKG

kibana-riya

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

19 lines (17 loc) 530 B
import uiModules from 'ui/modules'; let module = uiModules.get('kibana'); module.directive('autoSelectIfOnlyOne', function ($parse) { return { restrict: 'A', require: 'ngModel', link: function (scope, element, attributes, ngModelCtrl) { attributes.$observe('autoSelectIfOnlyOne', function (result) { let options = $parse(result)(scope); if (options && options.length === 1) { ngModelCtrl.$setViewValue(options[0]); ngModelCtrl.$render(); } }); } }; });