Angular UI Components Documentation
The Angular ComplexInput enables the user to edit complex and scientific numbers. This guide adds the Angular ComplexInput (jqxComplexInput) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxcomplexinput 
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 jqxComplexInputModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxComplexInputModule } from 'jqwidgets-ng/jqxcomplexinput';
@Component({
selector: 'app-root',
imports: [jqxComplexInputModule],
templateUrl: './app.html'
})
export class App {}
The source of the live Default Functionality demo.
<jqxComplexInput #myComplexInput
[width]="250" [height]="25" [value]="'15 + 7.2i'">
</jqxComplexInput>
<div style="margin-top: 20px;">
<jqxButton (onClick)="getRealPart()" [width]="150">
Get real part
</jqxButton>
<jqxButton (onClick)="getImaginarypart()" [width]="150">
Get imaginary part
</jqxButton>
</div>
import { Component, viewChild } from '@angular/core';
import { jqxComplexInputComponent } from 'jqwidgets-ng/jqxcomplexinput';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { jqxButtonModule } from 'jqwidgets-ng/jqxbuttons';
import { jqxComplexInputModule } from 'jqwidgets-ng/jqxcomplexinput';
@Component({
imports: [CommonModule, FormsModule, jqxButtonModule, jqxComplexInputModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
readonly myComplexInput = viewChild.required<jqxComplexInputComponent>('myComplexInput');
getRealPart(): void {
let realPart = this.myComplexInput().getReal();
alert(`Real part is ${realPart}`);
}
getImaginarypart(): void {
let imaginaryPart = this.myComplexInput().getImaginary();
alert(`Imaginary part is ${imaginaryPart}`);
}
}
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 value is changed.
<jqxComplexInput (onChange)="onChange($event)"></jqxComplexInput>
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 value.
<jqxComplexInput #myComplexInput></jqxComplexInput>
import { Component, viewChild } from '@angular/core';
import { jqxComplexInputModule, jqxComplexInputComponent } from 'jqwidgets-ng/jqxcomplexinput';
@Component({
selector: 'app-root',
imports: [jqxComplexInputModule],
templateUrl: './app.html'
})
export class App {
readonly myComplexInput = viewChild.required<jqxComplexInputComponent>('myComplexInput');
run(): void {
const value = this.myComplexInput().val();
console.log(value);
}
}