How to get started easily with Syncfusion Angular 9 Chips
|
|
|
The Essential JS2 Angular Chips component is used to small block of essential information that triggers an event on click action. It contains the text, image, or both and mostly used in contacts, mails, or filter tags. This article explains how to easily get started with EJ2 Chips component in the Angular 9 project with minimal code.
Prerequisites
Before starting, the following tools and SDK needs to be installed in your machine to Angular 9 application:
- Node.js (v8.10.0 or above)
- Angular 9
- Angular CLI
Installation and application creation
You can install Angular CLI 9 using the following command.
npm install -g @angular/[email protected] |
To follow and run the application in Angular 8 or earlier version, you can replace the CLI command version with your preferred version and install it. |
npm install -g @angular/cli@<CLI VERSION> |
Create an Angular 9 application
ng new chips-angular9 cd chips-angular9 |
Installing EJ2 Chips
npm install @syncfusion/ej2-angular-buttons --save |
Serve the application
ng serve --open |
Your application will open in a browser in the http://localhost:4200. Refer to the following example screenshot for Angular 9 version.

Adding Angular 9 Chips
You can add the Angular 9 Chips component by using `ejs-chiplist` tag and the attributes used within this tag allows you to define other Chips functionalities.
- Import ChipListModule into app.module.ts file from the @syncfusion/ej2-angular-buttons package.
[app.module.ts]
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core';
import { AppComponent } from './app.component'; import { ChipListModule } from '@syncfusion/ej2-angular-buttons';
@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, ChipListModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
|
- Import the CSS styles of the Chips component.
[style.css]
@import '../node_modules/@syncfusion/ej2-base/styles/material.css'; @import '../node_modules/@syncfusion/ej2-angular-buttons/styles/material.css'; |
- Add the Chips component in the template file.
[app.component.html]
<ejs-chiplist> <e-chips> <e-chip text="Microsoft"></e-chip> <e-chip text="Apple"></e-chip> <e-chip text="Google"></e-chip> </e-chips> </ejs-chiplist>
|
- Run the application with the following command and you should the see the below represented output of the EJ2 Angular Chips component.
ng serve --open |

Filter Chip
Filter Chip allows you to select a multiple chip from the set of ChipList/ChipCollection. It can be enabled by setting the selection property to Multiple.
[app.component.html]
<ejs-chiplist selection="Multiple"> <e-chips> <e-chip text="Microsoft"></e-chip> <e-chip text="Apple"></e-chip> <e-chip text="Google"></e-chip> </e-chips> </ejs-chiplist>
|
|
After mapping the properties, you should see the Chips when you run the application as below.

Summary
Refer to our documentation and online samples for more features. If you have any queries, please let us know in comments below. You can also contact us through our Support forum or Direct-Trac. We are happy to assist you!
|
|
|