Every line of 'angularjs autocomplete dropdown' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
101 showDropdown() { 102 if (!this.dropdownMenu.hasClass('show')) { 103 this.dropdownToggle.dropdown('toggle'); 104 } 105 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
51 function initAutocomplete() { 52 autocomplete = new google.maps.places.Autocomplete(input, options); 53 54 element.bind('blur', function (event) { 55 event.preventDefault(); 56 }); 57 58 element.bind('keydown', function (event) { 59 if (event.which == keymap.enter) { 60 event.preventDefault(); 61 } 62 }); 63 64 if ($scope.forceSelection) { 65 initForceSelection(); 66 } 67 68 google.maps.event.addListener(autocomplete, 'place_changed', function () { 69 $scope.$apply(function () { 70 ngModelController.$setViewValue(element.val()); 71 onPlaceChanged($scope.$parent, { $autocomplete: autocomplete, $element: element }); 72 }); 73 }); 74 }
3 function Autocomplete (attrs) { 4 Parent.call(this, attrs) 5 }
173 constructor(elementRef: ElementRef, public autoComplete: NguiAutoComplete) { 174 this.el = elementRef.nativeElement; 175 }
81 public ngOnInit(): void { 82 if (!this.options) { 83 throw new Error('Attribute \'options\' is required'); 84 } 85 86 this.popover.hide = () => { 87 this.popover.isVisible = false; 88 this.onSelect(this.getNewValueOnLeave()); 89 for (let i = 0; i < this.visibleOptions.length; i++) { 90 if (this.ngModel === this.visibleOptions[i]) { 91 this.text = this.visibleOptions[i]; 92 return; 93 } 94 } 95 this.text = this.ngModel; 96 }; 97 }
65 private triggerAutocomplete() { 66 if (this.ddDisabled || this.isDisabled || !this.focused || !this.autocomplete) { 67 this.autocomplete.close(); 68 return; 69 } 70 71 this.autocomplete.open({ 72 target: this.elementRef, 73 value: this.elementRef.nativeElement.value 74 }); 75 76 this.afterCloseSub && this.afterCloseSub.unsubscribe(); 77 this.afterCloseSub = this.autocomplete.afterClose.subscribe((value: any) => { 78 if (value === undefined) { 79 return; 80 } 81 82 let inputValue: string; 83 if (typeof this.mapInputValue === 'function') { 84 inputValue = this.mapInputValue(value); 85 } else if (this.mapInputValue === 'void') { 86 inputValue = ''; 87 } else { 88 inputValue = String(value); 89 } 90 91 if (value !== undefined) { 92 this.elementRef.nativeElement.value = inputValue; 93 this.deactivateFocusTrigger = true; 94 this.elementRef.nativeElement.focus(); 95 this.deactivateFocusTrigger = false; 96 } 97 98 this.selectionChange.emit(value); 99 100 this.closeAutocomplete(); 101 }); 102 }
41 public registerDropdown(dropdown: CompleterDropdown | null) { 42 this.dropdown = dropdown; 43 }
143 ngAfterContentInit() { 144 this.templates.forEach((item: PrimeTemplate) => { 145 if (item.getType() === 'listItem') { 146 this.externalItemListTemplate = item.template; 147 } else if (item.getType() === 'select') { 148 this.externalSelectTemplate = item.template; 149 } 150 }); 151 }
82 value: function selectAutoComplete(e) { 83 if (typeof this.props.onClick !== 'undefined') { 84 this.props.onClick(e); 85 } 86 87 var autocomplete = this.refs.autocomplete; 88 autocomplete.className = this.props.classPrefix + '__menu ' + this.props.classPrefix + '__menu--hidden'; 89 var result = e.target.innerHTML; 90 this.refs.searchInput.value = result; 91 }
131 function autocomplete( ev, options ) { 132 133 if ( !options || !options.hasOwnProperty( 'complete' ) ) { 134 135 return; 136 137 } 138 139 var compl = options.complete, 140 $this = $( this ), 141 strings, strings_len; 142 143 switch ( $.type( compl ) ) { 144 145 case 'function': 146 strings = compl.call( $this[0], ev, options ); break; 147 148 case 'array': 149 strings = compl.filter(function( e ) { 150 151 return ( e.indexOf( $this.val() ) === 0 ); 152 153 }); 154 break; 155 156 default: 157 strings = []; 158 } 159 160 if (!( strings_len = strings.length )) { return; } 161 162 if ( strings_len === 1 ) { 163 164 return $this.val( strings[0] ); 165 166 } 167 168 if ( $.isFunction( options.completionsDisplay ) ) { 169 170 options.completionsDisplay.call($this, strings); 171 172 } 173 174 }