How to get started easily with Syncfusion Angular 11 Progress Button?
A quick start project that helps you to create an Angular 11 Progress Button with a minimal code configurations.
Angular 11 Progress Button
The following section explains you how to create a simple angular 11 Progress Button component.
Prerequisites
Before start, we need following items to create Angular Progress Button in Angular 11 application
- Node.js (latest version)
- Angular 11
- Angular CLI
- Typescript 4+
- Visual Studio Code for Editor
Dependencies
The angular 11 Progress Button is created from the Syncfusion ej2-angular-splitbuttons package from npmjs, which are distributed in npm as @syncfusion scoped packages.
Creating Angular Project
- Install Angular cli 11 using following command.
npm install -g @angular/cli@11.2.3
If you would like to follow and run the application in Angular 9, Angular 8, Angular 7, Angular 6 or Angular 5 or Angular 4, you need to replace the CLI command version number with the corresponding angular version number.
npm install -g @angular/cli@<CLI VERSION>
- Create a new Angular 11 project using Angular cli and navigate to that folder.
ng new angular11-app cd angular11-app
Adding Angular Progress Button
- After running the Angular 11 application successfully, configure the Angular Progress Button in this application. Install Angular Progress Button and EJ2 package using following command.
npm install @syncfusion/ej2-angular-splitbuttons --save
The --save command will instruct the NPM to include a Progress Button package inside the dependencies section of the package.json.
- Import Progress Button from installed package.
- Import and inject the other required modules within the providers section of app.module.ts.
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { ProgressButtonModule } from '@syncfusion/ej2-angular-splitbuttons'; import { AppComponent } from './app.component'; @NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, ProgressButtonModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
- Add the given below angular progress button’s styles in styles.css.
@import "../node_modules/@syncfusion/ej2-base/styles/material.css"; @import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css"; @import "../node_modules/@syncfusion/ej2-buttons/styles/material.css"; @import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
- Add the angular Progress Button component in app.component.ts.
import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: `<button ejs-progressbutton content='Spin Left'></button>` }) export class AppComponent {}
- Now serve the application using following command.
ng serve --open
Once the files are compiled successfully, it will serve the site at localhost:4200
Screenshot:
Enable Progress in Button
You can enable the background filler UI by setting the enableprogress property to true.
[app.component.ts]
import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: `<button ejs-progressbutton content='Spin Left' [enableProgress]= 'true '></button>` }) export class AppComponent {}
Screenshot:
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!