Top
In theme we are using Abstract Elements for calling small widgets. so It will easy to use and user freindlly from developer perspective.
<button type="button" class="btn btn-primary">Primary Button</button>
<button type="button" class="btn btn-secondary">Secondary Button</button>
<button type="button" class="btn btn-success">Success Button</button>
<button type="button" class="btn btn-info">Info Button</button>
<button type="button" class="btn btn-warning">Warning Button</button>
<button type="button" class="btn btn-danger">Danger Button</button>
<button type="button" class="btn btn-light">Light Button</button>
To use another types button you have to link the related css file according to types of buttons in a head tag
<button type="button" class="btn btn-secondary">Secondary Button</button>
<button type="button" class="btn btn-success">Success Button</button>
<button type="button" class="btn btn-info">Info Button</button>
<button type="button" class="btn btn-warning">Warning Button</button>
<button type="button" class="btn btn-danger">Danger Button</button>
<button type="button" class="btn btn-light">Light Button</button>
<span class="badge badge-secondary">Secondary</span>
<span class="badge badge-success">Success</span>
<span class="badge badge-info">Info</span>
<span class="badge badge-warning text-dark">Warning</span>
<span class="badge badge-danger">Danger</span>
<span class="badge badge-light text-dark">Light</span>
<span class="badge badge-dark tag-pills-sm-mb">Dark</span>
<div class="alert alert-secondary" role="alert">This is a light alert—check it out!</div>
<div class="alert alert-success" role="alert">This is a success alert—check it out!</div>
<div class="alert alert-info" role="alert">This is a danger alert—check it out!</div>
<div class="alert alert-warning" role="alert">This is a secondary alert—check it out!</div>
<div class="alert alert-danger" role="alert">This is a warning alert—check it out!</div>
<div class="alert alert-light" role="alert">This is a dark alert—check it out!</div>
<div class="alert alert-dark" role="alert">This is a dark alert—check it out!</div>
<button class="btn btn-primary example-popover" type="button" placement="left" popoverTitle="Basic Popover" ngbPopover="If the package restore doesn't help, you can look at the Output window in the Visual Studio.">Hurry Up! </button>
<button class="example-popover btn btn-warning" type="button" placement="bottom" popoverTitle="Hover Popover" data-offset="-20px -20px" ngbPopover=" Several utility instruction sets have been featured in the Bootstrap 4 to promote very easy learning for beginners in the business of web building.">Hover tooltip</button>
<a class="btn btn-lg btn-secondary" tabindex="0" role="button" placement="right" popoverTitle="Dismissible popover" ngbPopover="You are able to even develop and suggest improvements to the Bootstrap 4 before its final version is delivered.">Dismissible popover</a>
// tooltip.html //
<button class="example-popover btn btn-primary" type="button" data-bs-placement="top" title="Popover title" ngbTooltip="Basic Tooltip">
Hover Me
</button>
// tooltip.ts //
import { Component } from '@angular/core';
import { NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'tooltip',
imports: [NgbTooltipModule],
templateUrl: './tooltip.html',
styleUrls: ['./tooltip.scss']
})
export class Tooltip {
name = 'World';
}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum
<div class="card-body">
<ngbNav #nav="ngbNav" [activeId]="1" class="nav nav-tabs">
<li class="nav-item" [ngbNavItem]="1">
<a class="nav-link" ngbNavLink>Home</a>
<ng-template ngbNavContent>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been
the industry's standard dummy text ever since the 1500s, when an unknown printer took a
galley
of type and scrambled it to make a type specimen book. It has survived not only five
centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages,
and more recently with desktop publishing software like Aldus PageMaker including versions
of
Lorem Ipsum</p>
</ng-template>
</li>
<li ngbDropdown class="nav-item dropdown">
<a class="nav-link dropdown-toggle bg-transparent border-none" (click)="isShow = !isShow" ngbDropdownToggle>Dropdown</a>
<div class="dropdown-menu" ngbDropdownMenu [ngClass]="isShow ? 'd-block':'d-none'">
<button class="dropdown-item" ngbDropdownItem>Action</button>
<button class="dropdown-item" ngbDropdownItem>Another action</button>
<button class="dropdown-item" ngbDropdownItem>Something else here</button>
<div class="dropdown-divider"></div>
<button class="dropdown-item" ngbDropdownItem>Separated link</button>
</li>
<li class="nav-item" [ngbNavItem]="2">
<a class="nav-link" ngbNavLink>Profile</a>
<ng-template ngbNavContent>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been
the industry's standard dummy text ever since the 1500s, when an unknown printer took a
galley
of type and scrambled it to make a type specimen book. It has survived not only five
centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages,
and more recently with desktop publishing software like Aldus PageMaker including versions
of
Lorem Ipsum
</p>
</ng-template>
</li>
<li class="nav-item" [ngbNavItem]="3">
<a class="nav-link" ngbNavLink>Profile</a>
<ng-template ngbNavContent>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been
the industry's standard dummy text ever since the 1500s, when an unknown printer took a
galley
of type and scrambled it to make a type specimen book. It has survived not only five
centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages,
and more recently with desktop publishing software like Aldus PageMaker including versions
of
Lorem Ipsum
</p>
</ng-template>
</li>
<li class="nav-item" [ngbNavItem]="4">
<a class="nav-link" ngbNavLink>Contact</a>
<ng-template ngbNavContent>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has
been
the industry's standard dummy text ever since the 1500s, when an unknown printer took a
galley
of type and scrambled it to make a type specimen book. It has survived not only five
centuries,
but also the leap into electronic typesetting, remaining essentially unchanged. It was
popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages,
and more recently with desktop publishing software like Aldus PageMaker including versions
of
Lorem Ipsum
</p>
</ng-template>
</li>
</ul>
<div class="tab-content" id="myTabContent">
<div [ngbNavOutlet]="nav" class="mt-4">
</div>
</div>
<div ngbAccordion [closeOthers]="true">
@for (item of items; track item) {
<div ngbAccordionItem [collapsed]="item !== 'First'">
<h2 ngbAccordionHeader>
<button ngbAccordionButton>{{ item }}</button>
</h2>
<div ngbAccordionCollapse>
<div ngbAccordionBody>
<ng-template>
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon
officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3
wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.
Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan
excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt
you probably haven't heard of them accusamus labore sustainable VHS.
</ng-template>
</div>
</div>
</div>
}
</div>
import { Component } from '@angular/core';
import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngbd-accordion-static',
imports: [NgbAccordionModule],
templateUrl: './accordion-static.html',
})
export class NgbdAccordionStatic {
items = ['First', 'Second', 'Third'];
}
Installing and usage
npm i ngx-toastr
// toster.html
<button class="btn btn-primary" type="button" id="liveToastBtn" (click)="showSuccess()">Show live toast</button>
// toster.ts
import { Component, OnInit } from "@angular/core";
import { ToastrService } from "ngx-toastr";
import { Breadcrumb } from "../../../shared/components/breadcrumb/breadcrumb";
@Component({
selector: "app-toaster",
templateUrl: "./toaster.html",
styleUrls: ["./toaster.scss"],
imports: [Breadcrumb],
})
export class Toaster implements OnInit {
constructor(private toastr: ToastrService) {}
showSuccess() {
this.toastr.success("everything is broken", "Major Error", {
timeOut: 3000,
});
}
}
Installing and usage
Installing and usage
npm i @sweetalert2/ngx-sweetalert2
// sweetalert2.html
<button class="btn btn-primary sweet-1" type="button" (click)="basicAlert()">Basic</button>
// sweetalert2.ts
import { Component } from '@angular/core';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
import Swal from 'sweetalert2';
@Component({
selector: 'app-sweet-alert2',
templateUrl: './sweet-alert2.html',
styleUrls: ['./sweet-alert2.scss'],
imports: [Breadcrumb]
})
export class SweetAlert2 {
basicAlert() {
Swal.fire('Hello world!')
}
}
Installing and usage
npm i @angular-slider/ngx-slider
// range-slider.html //
<ngx-slider [(value)]="value" [options]="options"></ngx-slider>
// range-slider.ts //
import { Component } from '@angular/core';
import { Options } from '@angular-slider/ngx-slider';
@Component({
selector: 'app-range-slider',
templateUrl: './range-slider.html',
styleUrls: ['./range-slider.scss'],
imports: [Breadcrumb, FormsModule, NgxSliderModule]
})
export class RangeSlider {
value: number = 100;
options: Options = {
floor: 0,
ceil: 200
};
}
Installing and usage
npm i ngx-dropzone-wrapper
// dropzone.html
<dropzone body [config]="imageConfig" (error)="onUploadError($event)" (success)="onUploadSuccess($event)"
[message]="text" class="custom-drop-zone custom-dropzone-1"></dropzone>
// dropzone.ts
import { Component } from '@angular/core';
import { DropzoneConfigInterface, DropzoneModule } from 'ngx-dropzone-wrapper';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
@Component({
selector: 'app-dropzone',
templateUrl: './dropzone.html',
styleUrls: ['./dropzone.scss'],
imports: [Breadcrumb, DropzoneModule]
})
export class Dropzone {
public imageConfig: DropzoneConfigInterface = {
url: 'https://httpbin.org/post',
clickable: true,
uploadMultiple:false,
acceptedFiles: 'image/*',
addRemoveLinks: true,
maxFiles: 1
};
public text = 'Drop files here or click to upload.
(This is just a demo dropzone. Selected files are not actually uploaded.)'
onUploadError(args: any): void {
console.log("onUploadError:", args);
}
onUploadSuccess(args: any): void {
console.log("onUploadSuccess:", args);
}
}
Installing and usage
npm i @danielmoncada/angular-datetime-picker
//datetimepicker.html //
<input class="form-control digits" name="birthdate" placeholder="yyyy-mm-dd" [owlDateTimeTrigger]="dt3" [owlDateTime]="dt3">
<owl-date-time [pickerType]="'calendar'" #dt3></owl-date-time>
//datetimepicker.ts //
import { Component } from '@angular/core';
import { OwlDateTimeModule } from '@danielmoncada/angular-datetime-picker';
import { Breadcrumb } from '../../../../shared/components/breadcrumb/breadcrumb';
import { DateRangePicker } from './date-range-picker/date-range-picker';
@Component({
selector: 'app-date-rangepicker',
templateUrl: './date-rangepicker.html',
styleUrls: ['./date-rangepicker.scss'],
imports: [Breadcrumb, DateRangePicker, OwlDateTimeModule]
})
export class DateRangepicker {
}
Installing and usage
npm i @ng-bootstrap/ng-bootstrap
// typeahead.html
<label for="typeahead-basic">Search for a state:</label>
<input id="typeahead-basic" type="text" class="form-control" [(ngModel)]="model" [ngbTypeahead]="search" />
<hr />
<pre>Model: {{ model | json }}</pre>
// typeahead.ts
import { Component } from '@angular/core';
import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
import { Observable, OperatorFunction } from 'rxjs';
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators';
import { FormsModule } from '@angular/forms';
import { JsonPipe } from '@angular/common';
const states = [
'Alabama',
'Alaska',
'American Samoa',
'Arizona',
'Arkansas',
'California',
'Colorado',
'Connecticut',
'Delaware',
'District Of Columbia',
'Federated States Of Micronesia',
'Florida',
'Georgia',
'Guam',
'Hawaii',
'Idaho',
'Illinois',
'Indiana',
'Iowa',
'Kansas',
'Kentucky',
'Louisiana',
'Maine',
'Marshall Islands',
'Maryland',
'Massachusetts',
'Michigan',
'Minnesota',
'Mississippi',
'Missouri',
'Montana',
'Nebraska',
'Nevada',
'New Hampshire',
'New Jersey',
'New Mexico',
'New York',
'North Carolina',
'North Dakota',
'Northern Mariana Islands',
'Ohio',
'Oklahoma',
'Oregon',
'Palau',
'Pennsylvania',
'Puerto Rico',
'Rhode Island',
'South Carolina',
'South Dakota',
'Tennessee',
'Texas',
'Utah',
'Vermont',
'Virgin Islands',
'Virginia',
'Washington',
'West Virginia',
'Wisconsin',
'Wyoming',
];
@Component({
selector: 'ngbd-typeahead-basic',
imports: [NgbTypeaheadModule, FormsModule, JsonPipe],
templateUrl: './typeahead-basic.html',
styles: `.form-control { width: 300px; }`,
})
export class NgbdTypeaheadBasic {
model: any;
search: OperatorFunction = (text$: Observable) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map((term) =>
term.length < 2 ? [] : states.filter((v) => v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10),
),
);
}
| # | First | Last | Handle |
|---|---|---|---|
| 1 | Mark | Otto | @mdo |
| 2 | Jacob | Thornton | @fat |
| 3 | Larry the Bird | ||
Installing and usage
npm i bootstrap
<table class="table">
<thead>
<tr>
<th scope="col"># </th>
<th scope="col">First </th>
<th scope="col">Last </th>
<th scope="col">Handle </th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1 </th>
<td>Mark </td>
<td>Otto </td>
<td>@mdo </td>
</tr>
<tr>
<th scope="row">2 </th>
<td>Jacob </td>
<td>Thornton </td>
<td>@fat </td>
</tr>
<tr>
<th scope="row">3 </th>
<td colspan="2">Larry the Bird </td>
<td>@twitter </td>
</tr>
</tbody>
</table>
Installing and usage
npm i @ng-bootstrap/ng-bootstrap
// country.html
<form>
<div class="mb-3 row">
<label for="table-complete-search" class="col-xs-3 col-sm-auto col-form-label">Full text search:</label>
<div class="col-xs-3 col-sm-auto">
<input
id="table-complete-search"
type="text"
class="form-control"
name="searchTerm"
[(ngModel)]="service.searchTerm"
/>
</div>
@if (service.loading$ | async) {
<span class="col col-form-label">Loading...</span>
}
</div>
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col" sortable="name" (sort)="onSort($event)">Country</th>
<th scope="col" sortable="area" (sort)="onSort($event)">Area</th>
<th scope="col" sortable="population" (sort)="onSort($event)">Population</th>
</tr>
</thead>
<tbody>
@for (country of countries$ | async; track country.id) {
<tr>
<th scope="row">{{ country.id }}</th>
<td>
<img
[src]="'https://upload.wikimedia.org/wikipedia/commons/' + country.flag"
[alt]="'The flag of ' + country.name"
class="me-2"
style="width: 20px"
/>
<ngb-highlight [result]="country.name" [term]="service.searchTerm" />
</td>
<td><ngb-highlight [result]="country.area | number" [term]="service.searchTerm" /></td>
<td><ngb-highlight [result]="country.population | number" [term]="service.searchTerm" /></td>
</tr>
} @empty {
<tr>
<td colspan="4" style="text-align: center">No countries found</td>
</tr>
}
</tbody>
</table>
<div class="d-flex justify-content-between p-2">
<ngb-pagination [collectionSize]="(total$ | async)!" [(page)]="service.page" [pageSize]="service.pageSize">
</ngb-pagination>
<select class="form-select" style="width: auto" name="pageSize" [(ngModel)]="service.pageSize">
<option [ngValue]="2">2 items per page</option>
<option [ngValue]="4">4 items per page</option>
<option [ngValue]="6">6 items per page</option>
</select>
</div>
</form>
// country.ts
import { AsyncPipe, DecimalPipe } from '@angular/common';
import { Component, QueryList, ViewChildren } from '@angular/core';
import { Observable } from 'rxjs';
import { Country } from './country';
import { CountryService } from './country.service';
import { NgbdSortableHeader, SortEvent } from './sortable.directive';
import { FormsModule } from '@angular/forms';
import { NgbHighlight, NgbPaginationModule } from '@ng-bootstrap/ng-bootstrap';
@Component({
selector: 'ngbd-table-complete',
imports: [DecimalPipe, FormsModule, AsyncPipe, NgbHighlight, NgbdSortableHeader, NgbPaginationModule],
templateUrl: './table-complete.html',
providers: [CountryService, DecimalPipe],
})
export class NgbdTableComplete {
countries$: Observable;
total$: Observable;
@ViewChildren(NgbdSortableHeader) headers: QueryList;
constructor(public service: CountryService) {
this.countries$ = service.countries$;
this.total$ = service.total$;
}
onSort({ column, direction }: SortEvent) {
// resetting other headers
this.headers.forEach((header) => {
if (header.sortable !== column) {
header.direction = '';
}
});
this.service.sortColumn = column;
this.service.sortDirection = direction;
}
}
// country.service.ts
import { Injectable, PipeTransform } from '@angular/core';
import { BehaviorSubject, Observable, of, Subject } from 'rxjs';
import { Country } from './country';
import { COUNTRIES } from './countries';
import { DecimalPipe } from '@angular/common';
import { debounceTime, delay, switchMap, tap } from 'rxjs/operators';
import { SortColumn, SortDirection } from './sortable.directive';
interface SearchResult {
countries: Country[];
total: number;
}
interface State {
page: number;
pageSize: number;
searchTerm: string;
sortColumn: SortColumn;
sortDirection: SortDirection;
}
const compare = (v1: string | number, v2: string | number) => (v1 < v2 ? -1 : v1 > v2 ? 1 : 0);
function sort(countries: Country[], column: SortColumn, direction: string): Country[] {
if (direction === '' || column === '') {
return countries;
} else {
return [...countries].sort((a, b) => {
const res = compare(a[column], b[column]);
return direction === 'asc' ? res : -res;
});
}
}
function matches(country: Country, term: string, pipe: PipeTransform) {
return (
country.name.toLowerCase().includes(term.toLowerCase()) ||
pipe.transform(country.area).includes(term) ||
pipe.transform(country.population).includes(term)
);
}
@Injectable({ providedIn: 'root' })
export class CountryService {
private _loading$ = new BehaviorSubject(true);
private _search$ = new Subject();
private _countries$ = new BehaviorSubject([]);
private _total$ = new BehaviorSubject(0);
private _state: State = {
page: 1,
pageSize: 4,
searchTerm: '',
sortColumn: '',
sortDirection: '',
};
constructor(private pipe: DecimalPipe) {
this._search$
.pipe(
tap(() => this._loading$.next(true)),
debounceTime(200),
switchMap(() => this._search()),
delay(200),
tap(() => this._loading$.next(false)),
)
.subscribe((result) => {
this._countries$.next(result.countries);
this._total$.next(result.total);
});
this._search$.next();
}
get countries$() {
return this._countries$.asObservable();
}
get total$() {
return this._total$.asObservable();
}
get loading$() {
return this._loading$.asObservable();
}
get page() {
return this._state.page;
}
get pageSize() {
return this._state.pageSize;
}
get searchTerm() {
return this._state.searchTerm;
}
set page(page: number) {
this._set({ page });
}
set pageSize(pageSize: number) {
this._set({ pageSize });
}
set searchTerm(searchTerm: string) {
this._set({ searchTerm });
}
set sortColumn(sortColumn: SortColumn) {
this._set({ sortColumn });
}
set sortDirection(sortDirection: SortDirection) {
this._set({ sortDirection });
}
private _set(patch: Partial) {
Object.assign(this._state, patch);
this._search$.next();
}
private _search(): Observable {
const { sortColumn, sortDirection, pageSize, page, searchTerm } = this._state;
// 1. sort
let countries = sort(COUNTRIES, sortColumn, sortDirection);
// 2. filter
countries = countries.filter((country) => matches(country, searchTerm, this.pipe));
const total = countries.length;
// 3. paginate
countries = countries.slice((page - 1) * pageSize, (page - 1) * pageSize + pageSize);
return of({ countries, total });
}
}
// country.directive.ts
import { Directive, EventEmitter, Input, Output } from '@angular/core';
import { Country } from './country';
export type SortColumn = keyof Country | '';
export type SortDirection = 'asc' | 'desc' | '';
const rotate: { [key: string]: SortDirection } = { asc: 'desc', desc: '', '': 'asc' };
export interface SortEvent {
column: SortColumn;
direction: SortDirection;
}
@Directive({
selector: 'th[sortable]',
host: {
'[class.asc]': 'direction === "asc"',
'[class.desc]': 'direction === "desc"',
'(click)': 'rotate()',
},
})
export class NgbdSortableHeader {
@Input() sortable: SortColumn = '';
@Input() direction: SortDirection = '';
@Output() sort = new EventEmitter();
rotate() {
this.direction = rotate[this.direction];
this.sort.emit({ column: this.sortable, direction: this.direction });
}
}
// country.ts
export interface Country {
id: number;
name: string;
flag: string;
area: number;
population: number;
}
Installing and usage
npm i ng-apexcharts
// apex-charts.html //
<apx-chart
[chart]="turnover.chart"
[series]="turnover.series"
[colors]="turnover.colors"
[dataLabels]="turnover.dataLabels"
[xaxis]="turnover.xaxis"
[yaxis]="turnover.yaxis"
[stroke]="turnover.stroke"
[labels]="turnover.labels"
[legend]="turnover.legend">
</apx-chart>=
// apex-chart.ts //
import { Component } from '@angular/core';
import * as chartData from '../../../../shared/data/charts/apex'
import { NgApexchartsModule } from 'ng-apexcharts';
@Component({
selector: 'app-basic-area',
templateUrl: './basic-area.html',
styleUrls: ['./basic-area.scss'],
imports: [NgApexchartsModule]
})
export class BasicArea {
public turnover = chartData.splineArea1
}
// apex-chart-data.ts //
import { ApexAxisChartSeries, ApexChart, ApexDataLabels, ApexStroke, ApexXAxis, ApexYAxis, ApexLegend, ApexTooltip, ApexPlotOptions, ApexFill, ApexAnnotations, ApexGrid, ApexTitleSubtitle, ApexTheme, ApexMarkers, ApexResponsive} from 'ng-apexcharts';
export interface SplineAreaChartOptions {
series: ApexAxisChartSeries;
colors: string[];
chart: ApexChart;
dataLabels: ApexDataLabels;
stroke: ApexStroke;
labels: string[];
xaxis: ApexXAxis;
yaxis: ApexYAxis;
legend: ApexLegend;
}
export let splineArea1: SplineAreaChartOptions = {
series: [
{
name: 'STOCK ABC',
data: [
8107.85, 8128.0, 8122.9, 8165.5, 8340.7, 8423.7, 8423.5, 8514.3, 8481.85, 8487.7, 8506.9,
8626.2, 8668.95, 8602.3, 8607.55, 8512.9, 8496.25, 8600.65, 8881.1, 9340.85,
],
},
],
colors: [primary_color],
chart: {
type: 'area',
height: 350,
zoom: {
enabled: false,
},
toolbar: {
show: false,
},
},
dataLabels: {
enabled: false,
},
stroke: {
curve: 'straight',
},
labels: [
'13 Nov 2023',
'14 Nov 2023',
'15 Nov 2023',
'16 Nov 2023',
'17 Nov 2023',
'20 Nov 2023',
'21 Nov 2023',
'22 Nov 2023',
'23 Nov 2023',
'24 Nov 2023',
'27 Nov 2023',
'28 Nov 2023',
'29 Nov 2023',
'30 Nov 2023',
'01 Dec 2023',
'04 Dec 2023',
'05 Dec 2023',
'06 Dec 2023',
'07 Dec 2023',
'08 Dec 2023',
],
xaxis: {
type: 'datetime',
},
yaxis: {
opposite: true,
},
legend: {
horizontalAlign: 'left',
},
};
Installing and usage
npm i ng2-google-charts
// google-chart.html //
<google-chart [data]="areaChart1"></google-chart>
// google-chart.ts //
import { Component } from '@angular/core';
import * as chartData from '../../../../shared/data/charts/google-chart'
import { Ng2GoogleChartsModule } from 'ng2-google-charts';
@Component({
selector: 'app-area-chart1',
templateUrl: './area-chart1.html',
styleUrls: ['./area-chart1.scss'],
imports: [Ng2GoogleChartsModule]
})
export class AreaChart1 {
public areaChart1 = chartData.areaChart1
}
// google-chart-data.ts //
let primary_color = localStorage.getItem('primary_color') || 'var(--theme-default)';
let secondary_color = localStorage.getItem('secondary_color') || 'var(--theme-secondary)';
export var pieChart1 ={
chartType: 'PieChart',
dataTable: [
['Language', 'Speakers (in millions)'],
['Assamese', 13],
['Bengali', 83],
['Bodo', 1.4],
['Dogri', 2.3],
['Gujarati', 46],
['Hindi', 300],
['Kannada', 38],
['Kashmiri', 5.5],
['Konkani', 5],
['Maithili', 20],
['Malayalam', 33],
['Manipuri', 1.5],
['Marathi', 72],
['Nepali', 2.9],
['Oriya', 33],
['Punjabi', 29],
['Sanskrit', 0.01],
['Santhali', 6.5],
['Sindhi', 2.5],
['Tamil', 61],
['Telugu', 74],
['Urdu', 52]
],
options: {
title: 'Indian Language Use',
legend: 'none',
width:'100%',
height: 400,
pieSliceText: 'label',
slices: { 4: {offset: 0.2},
12: {offset: 0.3},
14: {offset: 0.4},
15: {offset: 0.5},
},
// colors: ["#ab8ce4", "#26c6da"]
colors: [primary_color, secondary_color, "#222222", "#717171", "#e2c636", "#d22d3d","#e6edef", primary_color, secondary_color, "#222222", "#717171", "#e2c636","#d22d3d", primary_color, secondary_color, "#222222", "#717171", "#e2c636", "#d22d3d", primary_color,secondary_color, "#222222"]
}
}
Installing and usage
npm i ng2-charts
//chartjs.html//
<canvas baseChart class="chart" [datasets]="barChart.datasets" [options]="barChart.barOptions"
[data]="barChart"></canvas>
//chartjs.ts//
import { Component, ViewEncapsulation } from '@angular/core';
import { ChartEvent, ChartType } from 'chart.js';
import * as chartData from '../../../shared/data/charts/chartjs'
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
import { BaseChartDirective } from 'ng2-charts';
@Component({
selector: 'app-chartjs',
templateUrl: './chartjs.html',
styleUrls: ['./chartjs.scss'],
encapsulation: ViewEncapsulation.None,
imports: [BreadcrumbComponent, BaseChartDirective]
})
export class Chartjs {
// barChart
public barChart = chartData.barChart;
}
// chartjs-data.ts //
export const barChart = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
responsive: false,
datasets: [
{
label: 'My First dataset',
borderColor: primaryColor,
backgroundColor: 'rgba(115, 102 ,255, 0.6)',
borderWidth: 2,
data: [35, 59, 80, 81, 56, 55, 40],
},
{
label: 'My Second dataset',
borderColor: secondaryColor,
backgroundColor: 'rgb(131,131,131,0.6)',
borderWidth: 2,
data: [28, 48, 40, 19, 86, 27, 90],
},
],
barOptions: [
{
scaleBeginAtZero: true,
scaleShowGridLines: true,
scaleGridLineColor: 'rgba(0,0,0,0.1)',
scaleGridLineWidth: 1,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: true,
barShowStroke: true,
barStrokeWidth: 2,
barValueSpacing: 5,
barDatasetSpacing: 1,
},
],
};
// app.config.ts
import { ApplicationConfig, importProvidersFrom, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';
import { provideHttpClient } from '@angular/common/http';
import { provideAnimations } from '@angular/platform-browser/animations';
import { adapterFactory } from 'angular-calendar/date-adapters/date-fns';
import { provideCharts, withDefaultRegisterables } from 'ng2-charts';
import { provideToastr } from 'ngx-toastr';
import { routes } from './app.routes';
export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideAnimations(),
provideHttpClient() ,
provideCharts(withDefaultRegisterables()),
]
};
Installing and usage
npm i ng-chartist
// chartist.html
<x-chartist
[type]="chart1.type"
[data]="chart1.data"
[options]="chart1.options"
[events]="chart1.events">
</x-chartist>
// chartist.html
import { Component } from '@angular/core';
import * as chartData from '../../../shared/data/charts/chartist'
@Component({
selector: 'app-chartist',
templateUrl: './chartist.html',
styleUrls: ['./chartist.scss']
})
export class Chartist {
public chart1 = chartData.chart1;
}
// chartist-data.ts
import * as Chartist from 'chartist';
import { LineChartConfiguration } from 'ng-chartist';
export var configuration: LineChartConfiguration = {
type: 'Line',
data: {
labels: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
series: [
[12, 9, 7, 8, 5, 4, 6, 2, 3, 3, 4, 6],
[4, 5, 3, 7, 3, 5, 5, 3, 4, 4, 5, 5],
[5, 3, 4, 5, 6, 3, 3, 4, 5, 6, 3, 4],
[3, 4, 5, 6, 7, 6, 4, 5, 6, 7, 6, 3],
],
},
options: {
low: 0,
showArea: false,
fullWidth: true,
height: 250,
},
};
Installing and usage
npm i @angular/google-maps
// google-map.html
<google-map width="100%" height="500px" [zoom]="zoom">
@for (marker of markers; track marker) {
<map-marker [position]="marker.position" [label]="marker.label">
</map-marker>
}
</google-map>
// google-map.ts
import { Component, OnInit, ViewChild } from '@angular/core';
import { GoogleMap, GoogleMapsModule } from '@angular/google-maps';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
interface MarkerLabel {
color: string;
text: string;
}
interface MarkerData {
position: google.maps.LatLngLiteral;
label?: MarkerLabel;
title?: string;
options?: google.maps.MarkerOptions;
info?: string;
}
@Component({
selector: 'app-map-js',
templateUrl: './map-js.html',
styleUrls: ['./map-js.scss'],
imports: [Breadcrumb, GoogleMapsModule, ]
})
export class MapJs {
public markers: MarkerData[];
public zoom: number;
constructor() {
this.markers = [];
this.zoom = 2;
}
ngOnInit() {
this.markers?.push({
position: {
lat: 35.717,
lng: 139.731,
},
label: {
color: 'black',
text: 'Madrid',
},
options: {
draggable: true,
animation: google.maps.Animation.DROP,
},
});
this.markers?.push({
position: {
lat: 48.8615515,
lng: 2.3112233,
},
label: {
color: 'black',
text: 'Paris',
},
});
}
//Street View
readonly map = viewChild.required(GoogleMap);
ngAfterViewInit() {
const streetView = this.map()?.getStreetView();
streetView?.setOptions({
position: { lat: 38.9938386, lng: -77.2515373 },
pov: { heading: 70, pitch: -10 },
});
streetView?.setVisible(true);
}
}
Installing and usage
npm i @bluehalo/ngx-leaflet
// leaflet-map.html
<div class="map-height" leaflet [leafletOptions]="options1"<</div<
import { Component, } from '@angular/core';
import * as L from 'leaflet';
import { HttpClient } from "@angular/common/http";
import { LeafletModule } from 'npm i @bluehalo/ngx-leaflet';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
@Component({
selector: 'app-leaflet-map',
templateUrl: './leaflet-map.html',
styleUrls: ['./leaflet-map.scss'],
imports: [Breadcrumb, LeafletModule]
})
export class LeafletMap {
constructor(private http: HttpClient) {}
options1 = {
layers: [
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '...',
}),
],
zoom: 5,
center: L.latLng(46.879966, -121.726909),
};
layersControl = {
baseLayers: {
'Open Street Map': L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{ maxZoom: 18, attribution: '...' }
),
'Open Cycle Map': L.tileLayer(
'http://{s}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png',
{ maxZoom: 18, attribution: '...' }
),
},
overlays: {
'Big Circle': L.circle([46.95, -122], { radius: 5000 }),
'Big Square': L.polygon([
[46.8, -121.55],
[46.9, -121.55],
[46.9, -121.7],
[46.8, -121.7],
]),
},
};
}
Installing and usage
npm i ngx-editor
// ngx-editor.html
<div class="NgxEditor__Wrapper">
<ngx-editor-menu [editor]="editor"> </ngx-editor-menu>
<ngx-editor [editor]="editor" [ngModel]="html" [disabled]="false" [placeholder]="'Type here...'"></ngx-editor>
</div>
// ngx-editor.ts
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Editor, NgxEditorModule } from 'ngx-editor';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
@Component({
selector: 'app-ngx-editors',
templateUrl: './ngx-editors.html',
styleUrls: ['./ngx-editors.scss'],
imports: [Breadcrumb,NgxEditorModule,FormsModule]
})
export class Ngxditors implements OnInit {
public editor: Editor;
public html = '';
ngOnInit(): void {
this.editor = new Editor();
}
ngOnDestroy(): void {
this.editor.destroy();
}
}
Installing and usage
npm i @kolkov/angular-editor
// kolkov-editors.html
<angular-editor [placeholder]="'Enter text here...'" [(ngModel)]="htmlContent"></angular-editor>
// kolkov-editors.ts
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { AngularEditorModule } from '@kolkov/angular-editor';
import { Breadcrumb } from '../../../shared/components/breadcrumb/breadcrumb';
@Component({
selector: 'app-kolkov-editors',
templateUrl: './kolkov-editors.html',
styleUrls: ['./kolkov-editors.scss'],
imports: [Breadcrumb, AngularEditorModule, FormsModule]
})
export class KolkovEditors {
public htmlContent = '';
}