Angular UI Components Documentation
The Angular ComboBox enables the user to easily pick an item from a list of selectable items displayed in a drop-down. This guide adds the Angular ComboBox (jqxComboBox) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxcombobox 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxComboBoxModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxComboBoxModule } from 'jqwidgets-ng/jqxcombobox';
@Component({
selector: 'app-root',
imports: [jqxComboBoxModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<jqxComboBox
[width]='250' [height]='25'
[source]='source' [selectedIndex]='0'>
</jqxComboBox>
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { jqxComboBoxModule } from 'jqwidgets-ng/jqxcombobox';
@Component({
imports: [CommonModule, jqxComboBoxModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
source: any[] = this.generateHTML();
generateHTML(): any[] {
let source = new Array();
for (let i = 0; i < 10; i++) {
let movie = 'avatar.png';
let title = 'Avatar';
let year = 2009;
switch (i) {
case 1:
movie = 'endgame.png';
title = 'End Game';
year = 2006;
break;
case 2:
movie = 'priest.png';
title = 'Priest';
year = 2011;
break;
case 3:
movie = 'unknown.png';
title = 'Unknown';
year = 2011;
break;
case 4:
movie = 'unstoppable.png';
title = 'Unstoppable';
year = 2010;
break;
case 5:
movie = 'twilight.png';
title = 'Twilight';
year = 2008;
break;
case 6:
movie = 'kungfupanda.png';
title = 'Kung Fu Panda';
year = 2008;
break;
case 7:
movie = 'knockout.png';
title = 'Knockout';
year = 2011;
break;
case 8:
movie = 'theplane.png';
title = 'The Plane';
year = 2010;
break;
case 9:
movie = 'bigdaddy.png';
title = 'Big Daddy';
year = 1999;
break;
}
let html =
"<div style='padding: 0px; margin: 0px; height: 95px; float: left;'><img width='60'" +
"style='float: left; margin-top: 4px; margin-right: 15px;' src='https://www.jqwidgets.com/angular/images/" +
movie +
"'/><div style='margin-top: 10px; font-size: 13px;'>" +
'<b>Title</b><div>' +
title +
"</div><div style='margin-top: 10px;'><b>Year</b><div>" +
year.toString() +
'</div></div></div>';
source[i] = { html: html, title: title };
}
return source;
}
}Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, change: This event is triggered when the user selects an item.
<jqxComboBox (onChange)="onChange($event)"></jqxComboBox>
onChange(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, val: Sets or gets the selected value.
<jqxComboBox #myComboBox></jqxComboBox>
import { Component, viewChild } from '@angular/core';
import { jqxComboBoxModule, jqxComboBoxComponent } from 'jqwidgets-ng/jqxcombobox';
@Component({
selector: 'app-root',
imports: [jqxComboBoxModule],
templateUrl: './app.html'
})
export class App {
readonly myComboBox = viewChild.required<jqxComboBoxComponent>('myComboBox');
run(): void {
const value = this.myComboBox().val();
console.log(value);
}
}