Top
<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
<span class="badge badge-primary">Primary</span>
<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">Dark</span>
<div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-primary" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-secondary" role="progressbar" style="width: 50%" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-success" role="progressbar" style="width: 75%" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-info" role="progressbar" style="width: 100%" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
</div>
<div class="alert alert-primary" role="alert">This is a info alert—check it out!</div>
<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 type="button" class="btn btn-primary example-popover mr-1" data-bs-toggle="popover" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
<a tabindex="0" class="example-popover btn btn-secondary" role="button" data-bs-toggle="popover" data-bs-trigger="focus" title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
<button type="button" data-bs-trigger="hover" class="example-popover btn btn-success" data-container="body" data-bs-toggle="popover" data-bs-placement="bottom" title="Popover title" data-offset="-20px -20px" data-bs-content="Vivamus sagittis lacus vel augue laoreet rutrum faucibus." >On Hover Tooltip</button>
<button type="button" class="example-popover btn btn-primary" placement="top" ngbTooltip="Popover title">Hover Me</button>
<div ngbDropdown class="d-inline-block" placement="bottom">
<button class="btn btn-outline-primary" id="dropdownBasic1" ngbDropdownToggle >Dropdown Button</button>
<div ngbDropdownMenu aria-labelledby="dropdownBasic1">
<button class="dropdown-item">Action</button>
<button class="dropdown-item">Another Action</button>
<button class="dropdown-item">Something Else Here</button>
</div>
</div>
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
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
<ngx-tabset>
<ngx-tab tabTitle="Timeline">
<p class="mb-0 m-t-30">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>
</ngx-tab>
<ngx-tab>
....
</ngx-tab>
<ngx-tab title="Disabled" [disabled]="true">
....
</ngx-tab>
</ngx-tabset>
<div class="card">
<ngb-accordion [closeOthers]="true" activeIds="static-1">
<ngb-panel id="static-1" title="Collapsible Group Item #1">
<ng-template ngbPanelContent>
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>
</ngb-panel>
<ngb-panel id="static-2">
<ng-template ngbPanelTitle>
<span>Collapsible Group Item #1</span>
</ng-template>
<ng-template ngbPanelContent>
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>
</ngb-panel>
<ngb-panel id="static-3" title="Collapsible Group Item #3" >
<ng-template ngbPanelContent>
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>
</ngb-panel>
</ngb-accordion>
</div>
This is an Angular wrapper library for the Perfect Scrollbar. To use this library you should get familiar with the Perfect Scrollbar documentation as well since this documentation only explains details specific to this wrapper.
Installing and usagenpm install ngx-perfect-scrollbar --save
<perfect-scrollbar style="max-width: 600px; max-height: 400px;" [config]="config"> Scrollable content
</perfect-scrollbar>
import { PerfectScrollbarConfigInterface} from 'ngx-perfect-scrollbar';
export class ScrollableComponent implements OnInit
{
constructor() { }
ngOnInit() { }
public config: PerfectScrollbarConfigInterface =
{
suppressScrollX: false,
wheelPropagation: false,
useBothWheelAxes : true
};
}
Installing and usage
npm i ngx-treeview
<ngx-treeview [config]="config" [items]="items" (selectedChange)="onSelectedChange($event)" (filterChange)="onFilterChange($event)">
</ngx-treeview>
import { Component, OnInit } from '@angular/core';
import { TreeviewConfig, TreeviewItem } from 'ngx-treeview';
import { TreeViewService } from 'src/app/shared/services/advance/tree-view/tree-view.service';
@Component({
selector: 'app-tree-view',
templateUrl: './tree-view.component.html',
styleUrls: ['./tree-view.component.scss']
})
export class TreeViewComponent implements OnInit {
public config =TreeviewConfig.create(
{
hasAllCheckBox: false,
hasFilter: false,
hasCollapseExpand: false,
decoupleChildFromParent: false,
maxHeight: 500
})
public items: TreeviewItem[];
constructor( private service: TreeViewService) { }
ngOnInit(): void {
this.items = this.service.getItems();
}
}
Installing and usage
npm i ngx-owl-carousel-o
<div>Some tags before</div>
<owl-carousel-o [options]="customOptions">
<ng-template carouselSlide>Slide 1</ng-template>
<ng-template carouselSlide>Slide 2</ng-template>
<ng-template carouselSlide>Slide 3</ng-template>
</owl-carousel-o>
@Component({
selector: '....',
templateUrl: 'carousel-holder.component.html'
})
export class CarouselHolderComponent {
customOptions: any = {
loop: true,
mouseDrag: false,
touchDrag: false,
pullDrag: false,
dots: false,
navSpeed: 700,
navText: ['', ''],
responsive: {
0: {
items: 1
},
400: {
items: 2
},
740: {
items: 3
},
940: {
items: 4
}
},
nav: true
}
}
Installing and usage
npm install @ng-bootstrap/ng-bootstrap
<ngb-rating [(rate)]="currentRate"></ngb-rating>
Installing and usage
npm install --save sweetalert2
<div class="card-body btn-showcase">
<button type="button" class="btn btn-primary" (click)="basicAlert()">Basic</button>
</div>
// ES6 Modules or TypeScript
import Swal from 'sweetalert2'
// CommonJS
const Swal = require('sweetalert2')
...
//method call
basicAlert()
{
Swal.fire('Any fool can use a computer')
}
Installing and usage
npm i ng5-slider
<ng5-slider [(value)]="value" [options]="options"></ng5-slider>
import { Options } from 'ng5-slider';
...
@Component({...})
export class AppComponent {
value: number = 100;
options: Options = {
loor: 0,
floor: 0,
ceil: 200
};
}
Installing and usage
npm i ngx-image-cropper
<image-cropper [imageChangedEvent]="imageChangedEvent" [maintainAspectRatio]="true"
[containWithinAspectRatio]="containWithinAspectRatio" [aspectRatio]="4 / 3" [resizeToWidth]="256"
[cropperMinWidth]="128" [onlyScaleDown]="true" [roundCropper]="false" [canvasRotation]="canvasRotation"
[transform]="transform" [alignImage]="'left'" [style.display]="showCropper ? null : 'none'" format="png"
(imageCropped)="imageCropped($event)" (imageLoaded)="imageLoaded()" (cropperReady)="cropperReady($event)"
(loadImageFailed)="loadImageFailed()" >
import { Component, OnInit } from '@angular/core';
import { ImageTransform, ImageCroppedEvent, base64ToFile, Dimensions } from 'ngx-image-cropper';
@Component({
selector: 'app-image-croper',
templateUrl: './image-croper.component.html',
styleUrls: ['./image-croper.component.scss']
})
export class ImageCroperComponent {
imageChangedEvent: any = '';
croppedImage: any = '';
canvasRotation = 0;
rotation = 0;
scale = 1;
showCropper = false;
containWithinAspectRatio = false;
transform: ImageTransform = {};
fileChangeEvent(event: any): void {
this.imageChangedEvent = event;
}
imageCropped(event: ImageCroppedEvent) {
this.croppedImage = event.base64;
console.log(event, base64ToFile(event.base64));
}
imageLoaded() {
this.showCropper = true;
console.log('Image loaded');
}
cropperReady(sourceImageDimensions: Dimensions) {
console.log('Cropper ready', sourceImageDimensions);
}
loadImageFailed() {
console.log('Load failed');
}
rotateLeft() {
this.canvasRotation--;
this.flipAfterRotate();
}
rotateRight() {
this.canvasRotation++;
this.flipAfterRotate();
}
private flipAfterRotate() {
const flippedH = this.transform.flipH;
const flippedV = this.transform.flipV;
this.transform = {
...this.transform,
flipH: flippedV,
flipV: flippedH
};
}
flipHorizontal() {
this.transform = {
...this.transform,
flipH: !this.transform.flipH
};
}
flipVertical() {
this.transform = {
...this.transform,
flipV: !this.transform.flipV
};
}
resetImage() {
this.scale = 1;
this.rotation = 0;
this.canvasRotation = 0;
this.transform = {};
}
zoomOut() {
this.scale -= .1;
this.transform = {
...this.transform,
scale: this.scale
};
}
zoomIn() {
this.scale += .1;
this.transform = {
...this.transform,
scale: this.scale
};
}
toggleContainWithinAspectRatio() {
this.containWithinAspectRatio = !this.containWithinAspectRatio;
}
updateRotation() {
this.transform = {
...this.transform,
rotate: this.rotation
};
}
}
Installing and usage
npm i ngx-dropzone-wrapper
<div class="card-body">
<div class="dropzone dropzone-primary" [dropzone]="config1" (error)="onUploadError($event)"
(success)="onUploadSuccess($event)">
<div class="dz-message needsclick">
............
</div>
</div>
</div>
import { DropzoneConfigInterface } from 'ngx-dropzone-wrapper';
public config1: DropzoneConfigInterface = {
clickable: true,
maxFiles: 1,
autoReset: null,
errorReset: null,
cancelReset: null
}
Installing and usage
ng add ngx-bootstrap --component datepicker
<input type="text" placeholder="Datepicker" class="form-control" bsDatepicker>
Installing and usage
npm i @ng-select/ng-select
<ng-select [items]="people" bindLabel="name" bindValue="id" [(ngModel)]="selectedPersonId"></ng-select >
import { Component, OnInit } from '@angular/core';
import { DataService, Person } from '../data.service';
@Component({
selector: 'data-source-array-example',
templateUrl: './data-source-array-example.component.html',
styleUrls: ['./data-source-array-example.component.scss']
})
export class DataSourceArrayExampleComponent implements OnInit {
people: Person[] = [];
selectedPersonId = '5a15b13c36e7a7f00cf0d7cb';
selectedSimpleItem = 'Two';
simpleItems = [];
constructor(private dataService: DataService) {
}
ngOnInit() {
this.dataService.getPeople().subscribe(items => this.people = items);
this.simpleItems = [true, 'Two', 3];
}
}
Installing and usage
npm install @ng-bootstrap/ng-bootstrap
<input id="typeahead-basic" type="text" class="form-control" [(ngModel)]="model" [ngbTypeahead]="search" />
import {Component} from '@angular/core';
import {Observable} from 'rxjs';
import {debounceTime, distinctUntilChanged, map} from 'rxjs/operators';
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',
templateUrl: './typeahead-basic.html',
styles: [`.form-control { width: 300px; }`]
})
export class NgbdTypeaheadBasic {
public model: any;
search = (text$: Observable) =>
text$.pipe(
debounceTime(200),
distinctUntilChanged(),
map(term => term.length < 2 ? [] : states.filter(v=> v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10))
)
}
Installing and usage
npm install @ng-bootstrap/ng-bootstrap
<table class="table table-striped">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Country</th>
<th scope="col">Area</th>
<th scope="col">Population</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let country of countries; index as i">
<th scope="row">{{ i + 1 }}</th>
<td>
<img [src]="'https://upload.wikimedia.org/wikipedia/commons/' + country.flag" class="mr-2" style="width: 20px">
{{ country.name }}
</td>
<td>{{ country.area | number }}</td>
<td>{{ country.population | number }}</td>
</tr>
</tbody>
</table>
import { Component } from '@angular/core';
interface Country {
name: string;
flag: string;
area: number;
population: number;
}
const COUNTRIES: Country[] = [
{
name: 'Russia',
flag: 'f/f3/Flag_of_Russia.svg',
area: 17075200,
population: 146989754
},
{
name: 'Canada',
flag: 'c/cf/Flag_of_Canada.svg',
area: 9976140,
population: 36624199
},
{
name: 'United States',
flag: 'a/a4/Flag_of_the_United_States.svg',
area: 9629091,
population: 324459463
},
{
name: 'China',
flag: 'f/fa/Flag_of_the_People%27s_Republic_of_China.svg',
area: 9596960,
population: 1409517397
}
];
@Component({
selector: 'ngbd-table-basic',
templateUrl: './table-basic.html'
})
export class NgbdTableBasic {
countries = COUNTRIES;
}
Installing and usage
npm i ng2-google-charts
<google-chart [data]="pieChart1"></google-chart>
import { Component } from '@angular/core';
import * as chartData from '../../../shared/data/chart/google-chart';
@Component({
selector: 'app-google',
templateUrl: './google.component.html',
styleUrls: ['./google.component.scss']
})
export class GoogleComponent {
constructor() { }
public pieChart1= {
chartType: 'PieChart',
dataTable: [
['Task', 'Hours per Day'],
['Work', 5],
['Eat', 10],
['Commute', 15],
['Watch TV', 20],
['Sleep', 25]
],
options: {
title: 'My Daily Activities',
width: '100%',
height: 400,
colors: ["#4466f2", "#1ea6ec", "#22af47", "#007bff", "#FF5370"],
backgroundColor: 'transparent'
},
}
Installing and usage
npm i ng2-charts
<canvas baseChart class="chart" [datasets]="barChartData" [labels]="barChartLabels" [options]="barChartOptions"
[colors]="barChartColors" [legend]="barChartLegend" [chartType]="barChartType" (chartHover)="chartHovered($event)"
(chartClick)="chartClicked($event)"></canvas>
import { Component, ViewEncapsulation } from '@angular/core';
import * as chartData from '../../../shared/data/chart/chartjs';
@Component({
selector: 'app-chartjs',
templateUrl: './chartjs.component.html',
styleUrls: ['./chartjs.component.scss'],
encapsulation:ViewEncapsulation.None
})
export class ChartjsComponent {
constructor() { }
// barChart
public barChartOptions = {
scaleShowVerticalLines: false,
responsive: true
};
// events
public chartClicked(e:any):void { }
public chartHovered(e:any):void { }
Installing and usage
npm i ng-chartist
<x-chartist [type]="type" [data]="data" [options]="options" [events]="events"></x-chartist>
// bar-chart.component.ts
import {
IBarChartOptions,
IChartistAnimationOptions,
IChartistData
} from 'chartist';
import { ChartEvent, ChartType } from 'ng-chartist';
@Component({
selector: 'app-bar-chart',
template: `
<x-chartist [type]="type" [data]="data" [options]="options" [events]="events"></x-chartist>
`
]
})
export class BarChartComponent {
type: ChartType = 'Bar';
data: IChartistData = {
labels: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
],
series: [
[5, 4, 3, 7, 5, 10, 3, 4, 8, 10, 6, 8],
[3, 2, 9, 5, 4, 6, 4, 6, 7, 8, 7, 4]
]
};
options: IBarChartOptions = {
axisX: {
showGrid: false
},
height: 300
};
events: ChartEvent = {
draw: (data) => {
if (data.type === 'bar') {
data.element.animate({
y2: {
dur: '0.5s',
from: data.y1,
to: data.y2,
easing: 'easeOutQuad'
}
});
}
}
};
}
Installing and usage
npm i @swimlane/ngx-charts
<ngx-charts-pie-chart [view]="view" [scheme]="colorScheme" [results]="single" [gradient]="gradient"
[legend]="showLegend" [legendPosition]="legendPosition" [labels]="showLabels" [doughnut]="isDoughnut"
(select)="onSelect($event)" (activate)="onActivate($event)" (deactivate)="onDeactivate($event)">
</ngx-charts-pie-chart>
import { Component, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgxChartsModule } from '@swimlane/ngx-charts';
import { single } from './data';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
single: any[];
view: any[] = [700, 400];
// options
gradient: boolean = true;
showLegend: boolean = true;
showLabels: boolean = true;
isDoughnut: boolean = false;
legendPosition: string = 'below';
colorScheme = {
domain: ['#5AA454', '#A10A28', '#C7B42C', '#AAAAAA']
};
constructor() {
Object.assign(this, { single });
}
onSelect(data): void {
console.log('Item clicked', JSON.parse(JSON.stringify(data)));
}
onActivate(data): void {
console.log('Activate', JSON.parse(JSON.stringify(data)));
}
onDeactivate(data): void {
console.log('Deactivate', JSON.parse(JSON.stringify(data)));
}
}
Installing and usage
npm i ng-apexcharts
<apx-chart [series]="chartOptions.series" [chart]="chartOptions.chart" [xaxis]="chartOptions.xaxis"
[stroke]="chartOptions.stroke" [tooltip]="chartOptions.tooltip" [dataLabels]="chartOptions.dataLabels"></apx-chart>
import { Component, ViewChild } from "@angular/core";
import {
ChartComponent,
ApexAxisChartSeries,
ApexChart,
ApexXAxis,
ApexDataLabels,
ApexTooltip,
ApexStroke
} from "ng-apexcharts";
export type ChartOptions = {
series: ApexAxisChartSeries;
chart: ApexChart;
xaxis: ApexXAxis;
stroke: ApexStroke;
tooltip: ApexTooltip;
dataLabels: ApexDataLabels;
};
@Component({
selector: "app-root",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
@ViewChild("chart") chart: ChartComponent;
public chartOptions: Partial;
constructor() {
this.chartOptions = {
series: [
{
name: "series1",
data: [31, 40, 28, 51, 42, 109, 100]
},
{
name: "series2",
data: [11, 32, 45, 32, 34, 52, 41]
}
],
chart: {
height: 350,
type: "area"
},
dataLabels: {
enabled: false
},
stroke: {
curve: "smooth"
},
xaxis: {
type: "datetime",
categories: [
"2018-09-19T00:00:00.000Z",
"2018-09-19T01:30:00.000Z",
"2018-09-19T02:30:00.000Z",
"2018-09-19T03:30:00.000Z",
"2018-09-19T04:30:00.000Z",
"2018-09-19T05:30:00.000Z",
"2018-09-19T06:30:00.000Z"
]
},
tooltip: {
x: {
format: "dd/MM/yy HH:mm"
}
}
};
}
public generateData(baseval, count, yrange) {
var i = 0;
var series = [];
while (i < count) { var x=Math.floor(Math.random() * (750 - 1 + 1)) + 1; var y=Math.floor(Math.random() * (yrange.max
- yrange.min + 1)) + yrange.min; var z=Math.floor(Math.random() * (75 - 15 + 1)) + 15; series.push([x, y, z]);
baseval +=86400000; i++; } return series; } }
Installing and usage
@angular/google-maps
<google-map width="100%" height="450px" [zoom]="zoom">
<map-marker *ngFor="let marker of markers" [position]="marker.position" [label]="marker.label">
</map-marker>
</google-map>
import { Component, OnInit } from '@angular/core';
import { GoogleMap } from '@angular/google-maps';
@Component({
selector: 'app-google-map',
templateUrl: './google-map.component.html',
styleUrls: ['./google-map.component.scss']
})
export class GoogleMapComponent implements OnInit {
public markers: any[];
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"
},
Option:{
draggable: true,
animation: google.maps.Animation.DROP,
}
});
}
Installing and usage
npm i @asymmetrik/ngx-leaflet
<div style="height: 300px;" leaflet [leafletOptions]="options"></div>
import { Component, OnInit } from '@angular/core';
import * as L from 'leaflet';
import { HttpClient } from "@angular/common/http";
@Component({
selector: 'app-leaflet-map',
templateUrl: './leaflet-map.component.html',
styleUrls: ['./leaflet-map.component.scss']
})
export class LeafletMapComponent implements OnInit {
constructor(private http: HttpClient) { }
//First map options
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)
};
}
Installing and usage
npm install ngx-editor
<app-ngx-editor [placeholder]="'Enter text here...'" [spellcheck]="true"[(ngModel)]="htmlContent" ></app-ngx-editor>
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'ngx-editor',
templateUrl: './ngx-editor.component.html',
styleUrls: ['./ngx-editor.component.scss'],
// encapsulation: ViewEncapsulation.None
})
export class NgxEditorComponent implements OnInit {
public htmlContent: string = '';
constructor() {
}
ngOnInit(): void {
}
public editorConfig = {
editable: true,
spellcheck: false,
height: '10rem',
minHeight: '5rem',
placeholder: 'Type something. Test the Editor... ヽ(^。^)丿',
translate: 'no'
}
}
Installing and usage
npm i @ckeditor/ckeditor5-angular
<ck-editor name="editor1" [(ngModel)]="editorValue" skin="moono-lisa" language="en" [fullPage]="true"></ck-editor>
// app.component.ts
@Component({
selector: 'app',
templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
public editorValue: string = '';
ngOnInit() { }
}
Installing and usage
npm i ng2-ace-editor
<ace-editor [(text)]="text" #editor style="height:150px;"></ace-editor>
import { Component, OnInit, ViewChild } from '@angular/core';
import * as text from '../../../shared/data/editor/editor'
@Component({
selector: 'app-ace-editor',
templateUrl: './ace-editor.component.html',
styleUrls: ['./ace-editor.component.scss']
})
export class AceEditorComponent implements OnInit {
@ViewChild('editor') editor;
public text = text.text;
public text2 = text.text2;
public text3 = text.text3;
public text4 = text.text4;
ngAfterViewInit() {
this.editor.setTheme("eclipse");
}
ngOnInit(): void {
}
}