Sha256: f253d233cc6966f90963dac84d89a40e2c0c38e37bbbd014da3eab35f05b58c4

Contents?: true

Size: 846 Bytes

Versions: 234

Compression:

Stored size: 846 Bytes

Contents

/**
 * @ngdoc directive
 * @name Bastion.components.directive:typeaheadEmpty
 *
 *
 * @description
 *  Used to support autocompletion on focus, not just after the user types a single character
 *
 * @example
    <input
    typeahead="item as item.label for item in table.autocomplete($viewValue)"
    typeahead-empty />
 */

angular.module('Bastion.components').directive('typeaheadEmpty', function () {
    return {
        require: 'ngModel',
        link: function (scope, element, attrs, modelCtrl) {
            element.bind('focus', function () {
                if (angular.isUndefined(modelCtrl.$viewValue) || modelCtrl.$viewValue === '') {
                    modelCtrl.$setViewValue(' ');
                } else {
                    modelCtrl.$setViewValue(modelCtrl.$viewValue);
                }
            });
        }
    };
});

Version data entries

234 entries across 234 versions & 2 rubygems

Version Path
bastion-3.3.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.2.2 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.2.1 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.2.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.1.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.0.1 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-3.0.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.1.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.0.4 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.0.3 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.0.2 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.0.1 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-2.0.0 app/assets/javascripts/bastion/components/typeahead-empty.directive.js
bastion-1.0.2 app/assets/javascripts/bastion/components/typeahead-empty.directive.js