Installation
This is a Angular component module for upload images.
here we are using following package in component for deal with upload point.
import { HttpClient } from '@angular/common/http';
Installation is done using the npm install command:
$ npm install ng-upload-image
insert module selector to ❮name❯.component.html
import { NgUploadImageModule } from 'ng-upload-image';
@NgModule({
declarations: [ /* ... */ ],
imports: [
/* ... */
NgUploadImageModule,
],
providers: [],
bootstrap: [AppComponent],
})
Insert module selector to ❮name❯.component.html
<ng-upload-image
[apiUrl]= "'http://localhost:3000/uploads'"
></ng-upload-image>
Get feedback
<ng-upload-image
(onResponse)="getUploadResponse($event)"
[apiUrl]= "'http://localhost:3000/uploads'"
></ng-upload-image>
if need to receive the uploaded response to the component then add (onResponse) event binder inside tags.
note: you have to create getUploadResponse(res) method in ❮name❯.component.html