{"id":14520395,"url":"https://github.com/raysuelzer/ngx-angular-query-builder","last_synced_at":"2026-01-23T01:55:44.411Z","repository":{"id":38443845,"uuid":"431280821","full_name":"raysuelzer/ngx-angular-query-builder","owner":"raysuelzer","description":"A version of angular2-query-builder to work with Angular 12+ (Need maintainers)","archived":false,"fork":false,"pushed_at":"2024-08-21T17:35:40.000Z","size":721,"stargazers_count":38,"open_issues_count":10,"forks_count":54,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-31T22:35:53.073Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raysuelzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-23T23:07:06.000Z","updated_at":"2025-07-30T21:12:45.000Z","dependencies_parsed_at":"2024-09-04T04:05:05.503Z","dependency_job_id":"7e4d1507-0988-452c-b535-d510b6dceff0","html_url":"https://github.com/raysuelzer/ngx-angular-query-builder","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raysuelzer/ngx-angular-query-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysuelzer%2Fngx-angular-query-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysuelzer%2Fngx-angular-query-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysuelzer%2Fngx-angular-query-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysuelzer%2Fngx-angular-query-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raysuelzer","download_url":"https://codeload.github.com/raysuelzer/ngx-angular-query-builder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raysuelzer%2Fngx-angular-query-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28677714,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T01:00:35.747Z","status":"ssl_error","status_checked_at":"2026-01-23T01:00:19.529Z","response_time":144,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-04T04:01:42.106Z","updated_at":"2026-01-23T01:55:44.394Z","avatar_url":"https://github.com/raysuelzer.png","language":"TypeScript","readme":"# NgxAngularQueryBuilder\n\nThe goal of this project is to enable Angular 12+ support for the original [angular2-query-builder](https://github.com/zebzhao/Angular-QueryBuilder). It is _not_ production ready. This project may not be maintained. Should the original project become active again, this library may be abandoned.\n\n## I suggest forking this project if it is critical to your project because I may not update this regularly. If you want to contribute to maintaining this project open an issue.\n\nThe changelog for the package is here: https://github.com/raysuelzer/ngx-angular-query-builder/blob/main/projects/ngx-angular-query-builder/CHANGELOG.md\n\nThis project uses code from https://github.com/designermanjeets/Angular-QueryBuilder a fork of https://github.com/zebzhao/Angular-QueryBuilder both developed under the MIT License.\n\n## Change Log\n\nhttps://github.com/raysuelzer/ngx-angular-query-builder/blob/main/projects/ngx-angular-query-builder/CHANGELOG.md\n\n\n## Branches\n\n- Main should be the latest / highest version.\n- feature/* is where changes are staged before being merged\n- versions/* are the different versions for the angular packages ie. version 16 is versions/16.x.\n\n# Versions\n\nUse the following versions depending upon your angular version\n\n- Angular 12 \u0026 13 - Versions ^0.0.5\n- Angular 13 - Versions 13.x.x\n- Angular 14 - Versions 14.x.x\n- Angular 15 - Versions 15.x.x\n- Angular 16 - Versions 16.x.x\n- Angular 17 - Versions 17.x.x\n- Angular 18 - Versions 18.x.x\n\n# Examples\n\nnpm install ngx-angular-query-builder\n\n## Basic Usage\n\n##### `app.module.ts`\n\n```javascript\nimport { NgxAngularQueryBuilderModule } from \"ngx-angular-query-builder\";\nimport { AppComponent } from \"./app.component\"\n\n@NgModule(imports: [\n  ...,\n  NgxAngularQueryBuilderModule,\n])\nexport class AppModule { }\n```\n\n##### `app.component.html`\n\n```html\n...\n\u003cquery-builder [(ngModel)]=\"query\" [config]=\"config\"\u003e\u003c/query-builder\u003e\n...\n```\n\n##### `app.component.ts`\n\n```javascript\nimport { QueryBuilderConfig } from 'ngx-angular-query-builder';\n\nexport class AppComponent {\n  query = {\n    condition: 'and',\n    rules: [\n      {field: 'age', operator: '\u003c=', value: 'Bob'},\n      {field: 'gender', operator: '\u003e=', value: 'm'}\n    ]\n  };\n\n  config: QueryBuilderConfig = {\n    fields: {\n      age: {name: 'Age', type: 'number'},\n      gender: {\n        name: 'Gender',\n        type: 'category',\n        options: [\n          {name: 'Male', value: 'm'},\n          {name: 'Female', value: 'f'}\n        ]\n      }\n    }\n  }\n}\n```\n\n## Custom Input Components\n\n##### `app.component.html`\n\n```html\n\u003cquery-builder [(ngModel)]=\"query\" [config]=\"config\"\u003e\n  \u003cng-container *queryInput=\"let rule; type: 'date'\"\u003e\n    \u003ccustom-datepicker [(ngModel)]=\"rule.value\"\u003e\u003c/custom-datepicker\u003e\n  \u003c/ng-container\u003e\n\u003c/query-builder\u003e\n```\n\n##### `app.component.ts`\n\n```javascript\nquery = {\n  condition: 'and',\n  rules: [\n    {field: 'birthday', operator: '=', value: new Date()}\n  ]\n};\n\nconfig: QueryBuilderConfig = {\n  fields: {\n    birthday: {name: 'Birthday', type: 'date', operators: ['=', '\u003c=', '\u003e']\n      defaultValue: (() =\u003e return new Date())\n    },\n  }\n}\n```\n\n## Custom Styling (with Bootstrap 4)\n\n[Bootstrap demo](https://zebzhao.github.io/Angular-QueryBuilder/demo/).\n\n##### `app.component.html`\n\n```html\n\u003cquery-builder [(ngModel)]=\"query\" [config]=\"config\" [classNames]=\"classNames\"\u003e\u003c/query-builder\u003e\n```\n\n##### `app.component.ts`\n\n```javascript\nclassNames: QueryBuilderClassNames = {\n  removeIcon: \"fa fa-minus\",\n  addIcon: \"fa fa-plus\",\n  arrowIcon: \"fa fa-chevron-right px-2\",\n  button: \"btn\",\n  buttonGroup: \"btn-group\",\n  rightAlign: \"order-12 ml-auto\",\n  switchRow: \"d-flex px-2\",\n  switchGroup: \"d-flex align-items-center\",\n  switchRadio: \"custom-control-input\",\n  switchLabel: \"custom-control-label\",\n  switchControl: \"custom-control custom-radio custom-control-inline\",\n  row: \"row p-2 m-1\",\n  rule: \"border\",\n  ruleSet: \"border\",\n  invalidRuleSet: \"alert alert-danger\",\n  emptyWarning: \"text-danger mx-auto\",\n  operatorControl: \"form-control\",\n  operatorControlSize: \"col-auto pr-0\",\n  fieldControl: \"form-control\",\n  fieldControlSize: \"col-auto pr-0\",\n  entityControl: \"form-control\",\n  entityControlSize: \"col-auto pr-0\",\n  inputControl: \"form-control\",\n  inputControlSize: \"col-auto\"\n};\n```\n\n## Customizing with Angular Material\n\nExample of how you can completely customize the query component with another library like Angular Material. For the full example, please look at the [source code](https://github.com/zebzhao/Angular-QueryBuilder/blob/master/demo/src/app/app.component.ts) provided in the demo.\n\n#### `app.component.html`\n\n```html\n\u003cquery-builder [(ngModel)]=\"query\" [config]=\"config\"\u003e\n  \u003cng-container\n    *queryButtonGroup=\"let ruleset; let addRule=addRule; let addRuleSet=addRuleSet; let removeRuleSet=removeRuleSet\"\n  \u003e\n    \u003cbutton type=\"button\" mat-button (click)=\"addRule()\"\u003e+ Rule\u003c/button\u003e\n    \u003cbutton type=\"button\" mat-button (click)=\"addRuleSet()\"\u003e+ Ruleset\u003c/button\u003e\n    \u003cbutton type=\"button\" mat-button (click)=\"removeRuleSet()\"\u003e- Ruleset\u003c/button\u003e\n  \u003c/ng-container\u003e\n  \u003cng-container *queryRemoveButton=\"let rule; let removeRule=removeRule\"\u003e\n    \u003cbutton type=\"button\" mat-icon-button color=\"accent\" (click)=\"removeRule(rule)\"\u003e\n      \u003cmat-icon\u003eremove\u003c/mat-icon\u003e\n    \u003c/button\u003e\n  \u003c/ng-container\u003e\n  \u003cng-container *querySwitchGroup=\"let ruleset\"\u003e\n    \u003cmat-radio-group *ngIf=\"ruleset\" [(ngModel)]=\"ruleset.condition\"\u003e\n      \u003cmat-radio-button value=\"and\"\u003eAnd\u003c/mat-radio-button\u003e\n      \u003cmat-radio-button value=\"or\"\u003eOr\u003c/mat-radio-button\u003e\n    \u003c/mat-radio-group\u003e\n  \u003c/ng-container\u003e\n  \u003cng-container *queryField=\"let rule; let fields=fields; let onChange=onChange\"\u003e\n    \u003cmat-form-field\u003e\n      \u003cmat-select [(ngModel)]=\"rule.field\" (ngModelChange)=\"onChange($event, rule)\"\u003e\n        \u003cmat-option *ngFor=\"let field of fields\" [value]=\"field.value\"\u003e{{field.name}}\u003c/mat-option\u003e\n      \u003c/mat-select\u003e\n    \u003c/mat-form-field\u003e\n  \u003c/ng-container\u003e\n  \u003cng-container *queryOperator=\"let rule; let operators=operators\"\u003e\n    \u003cmat-form-field\u003e\n      \u003cmat-select [(ngModel)]=\"rule.operator\"\u003e\n        \u003cmat-option *ngFor=\"let value of operators\" [value]=\"value\"\u003e{{value}}\u003c/mat-option\u003e\n      \u003c/mat-select\u003e\n    \u003c/mat-form-field\u003e\n  \u003c/ng-container\u003e\n  \u003c!-- Override input component for 'boolean' type --\u003e\n  \u003cng-container *queryInput=\"let rule; type: 'boolean'\"\u003e\n    \u003cmat-checkbox [(ngModel)]=\"rule.value\"\u003e\u003c/mat-checkbox\u003e\n  \u003c/ng-container\u003e\n  \u003c!-- Override input component for 'category' type --\u003e\n  \u003cng-container *queryInput=\"let rule; let field=field; let options=options; type: 'category'\"\u003e\n    \u003cmat-form-field\u003e\n      \u003cmat-select [(ngModel)]=\"rule.value\" [placeholder]=\"field.name\"\u003e\n        \u003cmat-option *ngFor=\"let opt of options\" [value]=\"opt.value\"\u003e {{ opt.name }} \u003c/mat-option\u003e\n      \u003c/mat-select\u003e\n    \u003c/mat-form-field\u003e\n  \u003c/ng-container\u003e\n  ...\n\u003c/query-builder\u003e\n```\n\n## Property Bindings Quick Reference\n\nSee [documentation](https://zebzhao.github.io/Angular-QueryBuilder/) for more details on interfaces and properties.\n\n#### `query-builder`\n\n| Name                               | Type                                                                | Required | Default | Description                                                                                                                                                                                                                      |\n| :--------------------------------- | :------------------------------------------------------------------ | :------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `allowRuleset`                     | `boolean`                                                           | Optional | `true`  | Displays the `+ Ruleset` button if `true`.                                                                                                                                                                                       |\n| `allowCollapse`                    | `boolean`                                                           | Optional | `false` | Enables collapsible rule sets if `true`. ([See Demo](https://zebzhao.github.io/Angular-QueryBuilder/demo/))                                                                                                                      |\n| `classNames`                       | `object`                                                            | Optional |         | CSS class names for different child elements in `query-builder` component.                                                                                                                                                       |\n| `config`                           | `QueryBuilderConfig`                                                | Required |         | Configuration object for the main component.                                                                                                                                                                                     |\n| `data`                             | `Ruleset`                                                           | Optional |         | (Use `ngModel` or `value` instead.)                                                                                                                                                                                              |\n| `emptyMessage`                     | `string`                                                            | Optional |         | Message to display for an empty Ruleset if empty rulesets are not allowed.                                                                                                                                                       |\n| `ngModel`                          | `Ruleset`                                                           | Optional |         | Object that stores the state of the component. Supports 2-way binding.                                                                                                                                                           |\n| `operatorMap`                      | `{ [key: string]: string[] }`                                       | Optional |         | Used to map field types to list of operators.                                                                                                                                                                                    |\n| `persistValueOnFieldChange`        | `boolean`                                                           | Optional | `false` | If `true`, when a field changes to another of the same type, and the type is one of: string, number, time, date, or boolean, persist the previous value. This option is ignored if config.calculateFieldChangeValue is provided. |\n| `config.calculateFieldChangeValue` | `(currentField: Field, nextField: Field, currentValue: any) =\u003e any` | Optional |         | Used to calculate the new value when a rule's field changes.                                                                                                                                                                     |\n| `value`                            | `Ruleset`                                                           | Optional |         | Object that stores the state of the component.                                                                                                                                                                                   |\n\n## Structural Directives\n\nUse these directives to replace different parts of query builder with custom components. See [example](#customizing-with-angular-material), or [demo](https://zebzhao.github.io/Angular-QueryBuilder/demo/) to see how it's done.\n\n#### `queryInput`\n\nUsed to replace the input component. Specify the type/queryInputType to match specific field types to input template.\n\n| Context Name | Type         | Description                                                       |\n| :----------- | :----------- | :---------------------------------------------------------------- |\n| `$implicit`  | `Rule`       | Current rule object which contains the field, value, and operator |\n| `field`      | `Field`      | Current field object which contains the field's value and name    |\n| `options`    | `Option[]`   | List of options for the field, returned by `getOptions`           |\n| `onChange`   | `() =\u003e void` | Callback to handle changes to the input component                 |\n\n#### `queryOperator`\n\nUsed to replace the query operator selection component.\n\n| Context Name | Type         | Description                                                                                                    |\n| :----------- | :----------- | :------------------------------------------------------------------------------------------------------------- |\n| `$implicit`  | `Rule`       | Current rule object which contains the field, value, and operator                                              |\n| `operators`  | `string[]`   | List of operators for the field, returned by `getOperators`                                                    |\n| `onChange`   | `() =\u003e void` | Callback to handle changes to the operator component                                                           |\n| `type`       | `string`     | Input binding specifying the field type mapped to this input template, specified using syntax in above example |\n\n#### `queryField`\n\nUsed this directive to replace the query field selection component.\n\n| Context Name | Type                                       | Description                                                       |\n| :----------- | :----------------------------------------- | :---------------------------------------------------------------- |\n| `$implicit`  | `Rule`                                     | Current rule object which contains the field, value, and operator |\n| `getFields`  | `(entityName: string) =\u003e void`             | Get the list of fields corresponding to an entity                 |\n| `fields`     | `Field[]`                                  | List of fields for the component, specified by `config`           |\n| `onChange`   | `(fieldValue: string, rule: Rule) =\u003e void` | Callback to handle changes to the field component                 |\n\n#### `queryEntity`\n\nUsed to replace entity selection component.\n\n| Context Name | Type                                        | Description                                                       |\n| :----------- | :------------------------------------------ | :---------------------------------------------------------------- |\n| `$implicit`  | `Rule`                                      | Current rule object which contains the field, value, and operator |\n| `entities`   | `Entity[]`                                  | List of entities for the component, specified by `config`         |\n| `onChange`   | `(entityValue: string, rule: Rule) =\u003e void` | Callback to handle changes to the entity component                |\n\n#### `querySwitchGroup`\n\nUseful for replacing the switch controls, for example the AND/OR conditions. More custom conditions can be specified by using this directive to override the default component.\n\n| Context Name | Type         | Description                                                 |\n| :----------- | :----------- | :---------------------------------------------------------- |\n| `$implicit`  | `RuleSet`    | Current rule set object which contain a list of child rules |\n| `onChange`   | `() =\u003e void` | Callback to handle changes to the switch group component    |\n\n#### `queryArrowIcon`\n\nDirective to replace the expand arrow used in collapse/accordion mode of the query builder.\n\n| Context Name | Type      | Description                                                 |\n| :----------- | :-------- | :---------------------------------------------------------- |\n| `$implicit`  | `RuleSet` | Current rule set object which contain a list of child rules |\n\n#### `queryEmptyWarning`\n\nCan be used to customize the default empty warning message, alternatively can specify the `emptyMessage` property binding.\n\n| Context Name | Type      | Description                                                 |\n| :----------- | :-------- | :---------------------------------------------------------- |\n| `$implicit`  | `RuleSet` | Current rule set object which contain a list of child rules |\n| `message`    | `string`  | Value passed to `emptyMessage`                              |\n\n#### `queryButtonGroup`\n\nFor replacing the default button group for Add, Add Ruleset, Remove Ruleset buttons.\n\n| Context Name    | Type         | Description                                                 |\n| :-------------- | :----------- | :---------------------------------------------------------- |\n| `$implicit`     | `RuleSet`    | Current rule set object which contain a list of child rules |\n| `addRule`       | `() =\u003e void` | Function to handle adding a new rule                        |\n| `addRuleSet`    | `() =\u003e void` | Function to handle adding a new rule set                    |\n| `removeRuleSet` | `() =\u003e void` | Function to handle removing the current rule set            |\n\n#### `queryRemoveButton`\n\nDirective to replace the default remove single rule button component.\n\n| Context Name | Type                   | Description                                                       |\n| :----------- | :--------------------- | :---------------------------------------------------------------- |\n| `$implicit`  | `Rule`                 | Current rule object which contains the field, value, and operator |\n| `removeRule` | `(rule: Rule) =\u003e void` | Function to handle removing a rule                                |\n\n## Dependencies\n\n- Angular 12+\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.13.\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.\n","funding_links":[],"categories":["Table of contents","Recently Updated"],"sub_categories":["Third Party Components","[Sep 03, 2024](/content/2024/09/03/README.md)"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraysuelzer%2Fngx-angular-query-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraysuelzer%2Fngx-angular-query-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraysuelzer%2Fngx-angular-query-builder/lists"}