Skip to content

Commit b528086

Browse files
Merge pull request #1 from SyncfusionExamples/Angular-badge
Angular badge component
2 parents 5bdb8a9 + 8db04bf commit b528086

18 files changed

+439
-2
lines changed

.editorconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Editor configuration, see https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.ts]
12+
quote_type = single
13+
ij_typescript_use_double_quotes = false
14+
15+
[*.md]
16+
max_line_length = off
17+
trim_trailing_whitespace = false

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
2+
3+
# Compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
/bazel-out
8+
9+
# Node
10+
/node_modules
11+
npm-debug.log
12+
yarn-error.log
13+
14+
# IDEs and editors
15+
.idea/
16+
.project
17+
.classpath
18+
.c9/
19+
*.launch
20+
.settings/
21+
*.sublime-workspace
22+
23+
# Visual Studio Code
24+
.vscode/*
25+
!.vscode/settings.json
26+
!.vscode/tasks.json
27+
!.vscode/launch.json
28+
!.vscode/extensions.json
29+
.history/*
30+
31+
# Miscellaneous
32+
/.angular/cache
33+
.sass-cache/
34+
/connect.lock
35+
/coverage
36+
/libpeerconnection.log
37+
testem.log
38+
/typings
39+
40+
# System files
41+
.DS_Store
42+
Thumbs.db

README.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
1-
# getting-started-with-the-angular-badge-component
2-
A quick start project that shows how to create and configure the Syncfusion Angular Badge component in an Angular project. It includes a code snippet for different shapes and types of badges. It also includes a code snippet for integrating the Badge with the other UI components.
1+
# Getting Started with the angular Badge Component
2+
3+
A quick start project that shows how to create and configure the Syncfusion angular Badge component in a angular project. It includes a code snippet for different shapes and types of badges. It also includes a code snippet for integrating the Badge with the other UI components.
4+
5+
Refer to the following documentation to learn about the angular Badge component:
6+
https://ej2.syncfusion.com/angular/documentation/badge/getting-started
7+
8+
Check out this online example of the angular Badge component:
9+
https://ej2.syncfusion.com/angular/demos/#/material/badge/default
10+
11+
## Project prerequisites
12+
Make sure that you have the compatible versions of [Visual Studio Code](https://code.visualstudio.com/download ) and [NodeJS](https://nodejs.org/en/download) or later version in your machine before starting to work on this project.
13+
14+
## How to run this application
15+
To run this application, you need to first clone the `getting-started-with-the-angular-badge-component` repository and then open it in Visual Studio Code. Now, simply Build and run your project using the ng serve command to view the output.

angular.json

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{
2+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3+
"version": 1,
4+
"newProjectRoot": "projects",
5+
"projects": {
6+
"my-angular-app": {
7+
"projectType": "application",
8+
"schematics": {},
9+
"root": "",
10+
"sourceRoot": "src",
11+
"prefix": "app",
12+
"architect": {
13+
"build": {
14+
"builder": "@angular-devkit/build-angular:application",
15+
"options": {
16+
"outputPath": "dist/my-angular-app",
17+
"index": "src/index.html",
18+
"browser": "src/main.ts",
19+
"polyfills": [
20+
"zone.js"
21+
],
22+
"tsConfig": "tsconfig.app.json",
23+
"assets": [
24+
{
25+
"glob": "**/*",
26+
"input": "public"
27+
}
28+
],
29+
"styles": [
30+
"src/styles.css"
31+
],
32+
"scripts": []
33+
},
34+
"configurations": {
35+
"production": {
36+
"budgets": [
37+
{
38+
"type": "initial",
39+
"maximumWarning": "500kB",
40+
"maximumError": "1MB"
41+
},
42+
{
43+
"type": "anyComponentStyle",
44+
"maximumWarning": "4kB",
45+
"maximumError": "8kB"
46+
}
47+
],
48+
"outputHashing": "all"
49+
},
50+
"development": {
51+
"optimization": false,
52+
"extractLicenses": false,
53+
"sourceMap": true
54+
}
55+
},
56+
"defaultConfiguration": "production"
57+
},
58+
"serve": {
59+
"builder": "@angular-devkit/build-angular:dev-server",
60+
"configurations": {
61+
"production": {
62+
"buildTarget": "my-angular-app:build:production"
63+
},
64+
"development": {
65+
"buildTarget": "my-angular-app:build:development"
66+
}
67+
},
68+
"defaultConfiguration": "development"
69+
},
70+
"extract-i18n": {
71+
"builder": "@angular-devkit/build-angular:extract-i18n"
72+
},
73+
"test": {
74+
"builder": "@angular-devkit/build-angular:karma",
75+
"options": {
76+
"polyfills": [
77+
"zone.js",
78+
"zone.js/testing"
79+
],
80+
"tsConfig": "tsconfig.spec.json",
81+
"assets": [
82+
{
83+
"glob": "**/*",
84+
"input": "public"
85+
}
86+
],
87+
"styles": [
88+
"src/styles.css"
89+
],
90+
"scripts": []
91+
}
92+
}
93+
}
94+
}
95+
}
96+
}

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "my-angular-app",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"ng": "ng",
6+
"start": "ng serve",
7+
"build": "ng build",
8+
"watch": "ng build --watch --configuration development",
9+
"test": "ng test"
10+
},
11+
"private": true,
12+
"dependencies": {
13+
"@angular/animations": "^19.0.0",
14+
"@angular/common": "^19.0.0",
15+
"@angular/compiler": "^19.0.0",
16+
"@angular/core": "^19.0.0",
17+
"@angular/forms": "^19.0.0",
18+
"@angular/platform-browser": "^19.0.0",
19+
"@angular/platform-browser-dynamic": "^19.0.0",
20+
"@angular/router": "^19.0.0",
21+
"@syncfusion/ej2-angular-buttons": "^28.1.37",
22+
"@syncfusion/ej2-angular-navigations": "^28.1.37",
23+
"rxjs": "~7.8.0",
24+
"tslib": "^2.3.0",
25+
"zone.js": "~0.15.0"
26+
},
27+
"devDependencies": {
28+
"@angular-devkit/build-angular": "^19.0.7",
29+
"@angular/cli": "^19.0.7",
30+
"@angular/compiler-cli": "^19.0.0",
31+
"@types/jasmine": "~5.1.0",
32+
"jasmine-core": "~5.4.0",
33+
"karma": "~6.4.0",
34+
"karma-chrome-launcher": "~3.2.0",
35+
"karma-coverage": "~2.2.0",
36+
"karma-jasmine": "~5.1.0",
37+
"karma-jasmine-html-reporter": "~2.1.0",
38+
"typescript": "~5.6.2"
39+
}
40+
}

public/favicon.ico

14.7 KB
Binary file not shown.

src/app/app.component.css

Whitespace-only changes.

src/app/app.component.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<div class="container-div badge-toolbar">
2+
<div id="toolbar">
3+
<div>
4+
<span class='e-icons e-menu'></span>
5+
<div class="header">Notification</div>
6+
<div>
7+
<div class="badge-block">
8+
<div class="message icons"></div>
9+
<span class="e-badge e-badge-primary e-badge-notification e-badge-overlap">35</span>
10+
</div>
11+
</div>
12+
<div>
13+
<div class="badge-block">
14+
<div class="user-profile icons"></div>
15+
<span class="e-badge e-badge-success e-badge-notification e-badge-overlap">28</span>
16+
</div>
17+
</div>
18+
<div>
19+
<div class="badge-block">
20+
<div class="love icons"></div>
21+
<span class="e-badge e-badge-info e-badge-notification e-badge-overlap">98</span>
22+
</div>
23+
</div>
24+
</div>
25+
</div>
26+
</div>

src/app/app.component.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { TestBed } from '@angular/core/testing';
2+
import { AppComponent } from './app.component';
3+
4+
describe('AppComponent', () => {
5+
beforeEach(async () => {
6+
await TestBed.configureTestingModule({
7+
imports: [AppComponent],
8+
}).compileComponents();
9+
});
10+
11+
it('should create the app', () => {
12+
const fixture = TestBed.createComponent(AppComponent);
13+
const app = fixture.componentInstance;
14+
expect(app).toBeTruthy();
15+
});
16+
17+
it(`should have the 'my-angular-app' title`, () => {
18+
const fixture = TestBed.createComponent(AppComponent);
19+
const app = fixture.componentInstance;
20+
expect(app.title).toEqual('my-angular-app');
21+
});
22+
23+
it('should render title', () => {
24+
const fixture = TestBed.createComponent(AppComponent);
25+
fixture.detectChanges();
26+
const compiled = fixture.nativeElement as HTMLElement;
27+
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, my-angular-app');
28+
});
29+
});

src/app/app.component.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Component } from '@angular/core';
2+
import {ButtonModule} from '@syncfusion/ej2-angular-buttons';
3+
import {Toolbar} from '@syncfusion/ej2-navigations';
4+
5+
@Component({
6+
selector: 'app-root',
7+
imports: [ ButtonModule],
8+
templateUrl: './app.component.html',
9+
styleUrl: './app.component.css'
10+
})
11+
export class AppComponent {
12+
public ngAfterViewInit() {
13+
let toolbar: Toolbar = new Toolbar({
14+
});
15+
toolbar.appendTo('#toolbar');
16+
}
17+
}

src/app/app.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
2+
import { provideRouter } from '@angular/router';
3+
4+
import { routes } from './app.routes';
5+
6+
export const appConfig: ApplicationConfig = {
7+
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideRouter(routes)]
8+
};

src/app/app.routes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Routes } from '@angular/router';
2+
3+
export const routes: Routes = [];

src/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>MyAngularApp</title>
6+
<base href="/">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
</head>
10+
<body>
11+
<app-root></app-root>
12+
</body>
13+
</html>

src/main.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { bootstrapApplication } from '@angular/platform-browser';
2+
import { appConfig } from './app/app.config';
3+
import { AppComponent } from './app/app.component';
4+
5+
bootstrapApplication(AppComponent, appConfig)
6+
.catch((err) => console.error(err));

src/styles.css

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/* You can add global styles to this file, and also import other style files */
2+
/* You can add global styles to this file, and also import other style files */
3+
@import '../node_modules/@syncfusion/ej2-base/styles/material.css';
4+
@import '../node_modules/@syncfusion/ej2-notifications/styles/material.css';
5+
@import '../node_modules/@syncfusion/ej2-angular-buttons/styles/material.css';
6+
@import '../node_modules/@syncfusion/ej2-navigations/styles/material.css';
7+
8+
.container-div.badge-toolbar {
9+
display: table;
10+
margin: auto;
11+
margin-top: 117px;
12+
}
13+
14+
.element {
15+
text-align: center;
16+
margin-top: 50px;
17+
}
18+
19+
.e-icons.e-menu:before {
20+
content: "\e99a";
21+
}
22+
23+
.e-icons {
24+
font-size: 20px;
25+
font-weight: bolder;
26+
padding: 20px;
27+
}
28+
29+
.e-icons {
30+
font-family: "e-icons";
31+
font-style: normal;
32+
font-variant: normal;
33+
font-weight: normal;
34+
line-height: 1;
35+
text-transform: none;
36+
}
37+
38+
.container-div.badge-toolbar .badge-block {
39+
position: relative;
40+
display: inline-block;
41+
margin: 20px 13px 10px 10px;
42+
}
43+
44+
body.material-dark .e-toolbar-items {
45+
color: #ffffff;
46+
}
47+
48+
.icons {
49+
width: 28px;
50+
height: 28px;
51+
display: inline-block;
52+
}
53+
54+
#toolbar .header {
55+
font-size: 18px;
56+
margin-right: 56px;
57+
}
58+
59+
/* SVG Icons */
60+
.love {
61+
background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23a6a5a6' d='M8.532.81c3.029 0 5.932 1.668 7.468 4.521 2.139-3.97 6.922-5.644 11.008-3.726 4.289 2.012 6.177 7.212 4.218 11.617C29.273 17.614 16 31.19 16 31.19 15.916 31.137 2.727 17.614.774 13.222-1.186 8.817.703 3.617 4.993 1.605A8.299 8.299 0 0 1 8.532.81z'/%3E%3C/svg%3E") no-repeat 100% 100%;
62+
}
63+
64+
.message {
65+
background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23a6a5a6' d='M0 5.126h.024l7.547 7.393 8.405 8.252 8.405-8.252 7.547-7.393H32v22.6H0zm1.902-.852h28.195l-7.048 5.929L16 16.132l-7.049-5.929z'/%3E%3C/svg%3E") no-repeat 100% 100%;
66+
}
67+
68+
.user-profile {
69+
background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath fill='%23a6a5a6' d='M8.772 18.363a11.978 11.978 0 0 0 7.229 2.416c2.71 0 5.214-.899 7.229-2.416 4.71.593 8.354 4.61 8.354 9.481V32H.416v-4.156c0-4.871 3.646-8.888 8.356-9.481zM16.001 0a8.727 8.727 0 1 1-.003 17.455A8.727 8.727 0 0 1 16.001 0z'/%3E%3C/svg%3E") no-repeat 100% 100%;
70+
}

0 commit comments

Comments
 (0)