Advance UI Elements
Rating Offical link Preview link
Installation and Usage
npm i ngx-bar-rating
<ngb-rating [(rate)]="currentRate"></ngb-rating>
Dropzone Offical link Preview link
Installation and Usage
npm i ngx-dropzone
<dropzone [config]="imageConfig" [className]="'custom-drop-zone'" [message]="text" (error)="onUploadError($event)"(success)="onUploadSuccess($event)"></dropzone>
you have add to type script files
import { Component } from '@angular/core';
import { DropzoneConfigInterface, DropzoneModule } from "ngx-dropzone-wrapper";
@Component({
selector: 'app-default-file-upload',
templateUrl: './default-file-upload.html',
styleUrls: ['./default-file-upload.scss'],
imports: [DropzoneModule],
})
export class DefaultFileUpload {
imageConfig: DropzoneConfigInterface = {
clickable: true,
url: 'https://httpbin.org/post',
addRemoveLinks: true,
parallelUploads: 1,
};
public text = 'Drag & Drop your files or Browse';
onUploadError(args: any): void {
console.log("onUploadError:", args);
}
onUploadSuccess(args: any): void {
console.log("onUploadSuccess:", args);
}
}
Sweetalert Offical link Preview link
Installation 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')
}
Owl carousel Offical link Preview link
Installation and Usage
npm i ngx-owl-carousel-o
<div class="card-body">
<owl-carousel-o [options]="fadeoptionsData" class="carousel slide" id="carouselExampleSlidesOnly">
@for(fadeItem of crossfadeData; track fadeItem){
<ng-template carouselSlide class="carousel-inner">
<div class="carousel-inner">
<div class="carousel-item active"><img class="d-block w-100" src="{{fadeItem.img}}"
alt="drawing-room">
</div>
</div>
</ng-template>
}
</owl-carousel-o>
</div>
Range slider Offical link Preview link
Installation and Usage
npm i ng5-slider
<ng5-slider [(value)]="value" [options]="options"></ng5-slider>
Image cropper Offical link Preview link
Installation 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()">
</image-cropper>
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Dimensions, ImageCroppedEvent, ImageCropperComponent, ImageTransform } from 'ngx-image-cropper';
@Component({
selector: 'app-image-cropper',
templateUrl: './image-cropper.html',
styleUrls: ['./image-cropper.scss'],
imports: [ImageCropperComponent, FormsModule]
})
export class ImageCrop {
public imageChangedEvent: any = '';
public croppedImage: string | null | undefined = '';
public canvasRotation = 0;
public rotation = 0;
public scale = 1;
public showCropper = false;
public containWithinAspectRatio = false;
public transform: ImageTransform = {};
fileChangeEvent(event: any): void {
this.imageChangedEvent = event;
}
imageCropped(event: ImageCroppedEvent) {
this.croppedImage = event.base64;
}
imageLoaded() {
this.showCropper = true;
}
cropperReady(sourceImageDimensions: Dimensions) {
}
loadImageFailed() {
}
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
};
}
}