File

src/app/common/components/image-upload/ngx-image-upload.component.ts

Description

upload images component inspired from https://aberezkin.github.io/ng2-image-upload/#/demo

Metadata

selector ngx-image-upload
templateUrl ./ngx-image-upload.component.html

Index

Methods
Inputs
Outputs

Constructor

constructor()

Inputs

buttonCaption

Type: string

Outputs

onRemove $event type: EventEmitter
onUpload $event type: EventEmitter

Methods

onRemoved
onRemoved(file: FileHolder)
Parameters :
Name Type Optional
file FileHolder no
Returns : void
onUploadFinished
onUploadFinished(file: FileHolder)
Parameters :
Name Type Optional
file FileHolder no
Returns : void
import {Component, EventEmitter, Input, Output} from "@angular/core";
import {FileHolder, UploadMetadata} from "angular2-image-upload";


/**
 * upload images component inspired from https://aberezkin.github.io/ng2-image-upload/#/demo
 */
@Component({
  selector: 'ngx-image-upload',
  templateUrl: './ngx-image-upload.component.html'
})
export class NgxImageUploadComponent {
  @Input() buttonCaption: string;
  @Output() onUpload = new EventEmitter<any>();
  @Output() onRemove = new EventEmitter<any>();

  constructor() {
  }

  onUploadFinished(file: FileHolder): void {
    this.onUpload.next(file);
  }

  onRemoved(file: FileHolder): void {
    this.onRemove.next(file);
  }
}
<image-upload url="http://localhost:3000/api/upload"
              buttonCaption="{{buttonCaption}}"
              (uploadFinished)="onUploadFinished($event)"
              (removed)="onRemoved($event)"
              dropBoxMessage="تصویر خود را اینجا بیندازید"
              clearButtonCaption="حذف">
</image-upload>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""