13.0.5 • Published 4 years ago
@khanhvuongnh/media-upload v13.0.5
Table of contents
Usage & Demo
You can view a live demo here:

Installation
Install bootstrap from npm:
npm install bootstrapInstall ngx-bootstrap from npm:
npm install ngx-bootstrapInstall @khanhvuongnh/media-upload from npm:
npm install @khanhvuongnh/media-uploadImportant
Copy
assetsfolder fromnode_modulestoassetsfolder of current project.
Add module to NgModule imports:
import { MediaUploadModule } from '@khanhvuongnh/media-upload';
@NgModule({
...
imports: [MediaUploadModule,...]
...
})Add to demo.component.ts:
import { Component } from '@angular/core';
import { UploadMediaResponse } from '@khanhvuongnh/media-upload';
@Component({...})
export class DemoComponent {
file: File;
base64: string;
src: string;
mediaChanged(item: UploadMediaResponse) {
console.log(item);
}
submit() {
console.log(this.file);
console.log(this.base64);
}
}Add to demo.component.html:
<div style="width: 200px; margin: 5rem;">
<media-upload
[buttonUpload]="true"
[buttonRemove]="true"
[hoverEffect]="false"
[src]="src"
[openLinkInNewTab]="false"
[(file)]="file"
[(base64)]="base64"
(response)="mediaChanged($event)">
</media-upload>
<button class="btn btn-success mt-5" (click)="submit()">Submit</button>
</div>Compatibility
Three dependencies are Angular, Bootstrap and Ngx-Bootstrap. Here is the versions compatibility list:
| media-upload | Angular | Bootstrap CSS |
|---|---|---|
| 13.0.1 | 13.x.x | 5.0.x |