New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular2-image-upload

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular2-image-upload - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

3

lib/image-upload/image-upload.component.d.ts

@@ -1,2 +0,2 @@

import { ImageService } from "../image.service";
import { ImageService, Header } from "../image.service";
export declare class ImageUploadComponent {

@@ -6,2 +6,3 @@ private imageService;

url: string;
headers: Header[];
private isPending;

@@ -8,0 +9,0 @@ private onFileUploadFinish;

@@ -71,3 +71,3 @@ "use strict";

fileHolder.pending = true;
this.imageService.postImage(fileHolder.file).subscribe(function (response) {
this.imageService.postImage(fileHolder.file, this.headers).subscribe(function (response) {
fileHolder.serverResponse = response;

@@ -113,2 +113,6 @@ _this.onFileUploadFinish.emit(fileHolder);

__decorate([
core_1.Input(),
__metadata('design:type', Array)
], ImageUploadComponent.prototype, "headers", void 0);
__decorate([
core_1.Output(),

@@ -115,0 +119,0 @@ __metadata('design:type', core_1.EventEmitter)

@@ -0,6 +1,10 @@

export interface Header {
header: string;
value: string;
}
export declare class ImageService {
private url;
setUrl(url: string): void;
postImage(image: File): any;
postImage(image: File, headers?: Header[]): any;
private checkUrl();
}

@@ -19,3 +19,3 @@ "use strict";

};
ImageService.prototype.postImage = function (image) {
ImageService.prototype.postImage = function (image, headers) {
var _this = this;

@@ -39,2 +39,7 @@ this.checkUrl();

xhr.open('POST', _this.url, true);
if (headers)
for (var _i = 0, headers_1 = headers; _i < headers_1.length; _i++) {
var header = headers_1[_i];
xhr.setRequestHeader(header.header, header.value);
}
xhr.send(formData);

@@ -41,0 +46,0 @@ });

{
"name": "angular2-image-upload",
"version": "0.3.0",
"version": "0.3.1",
"description": "An angular component that uploads images using native browser upload or drag-n-drop.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,3 +56,3 @@ # Image Upload Module

`(onFileUploadFinish)="imageUploaded($event)"`. If `[src]` is specified this event is fired when component gets a responce from the server, also in this case event has field `serverResponse` which contains object returned by the server. If `[src]` is not specified it's fired immediately after an image(s) dropped into file-drop zone of choosed in file browser. So what you can do, is not specify `[src]` to handle upload yourself, for exapmple send the image into firebase storage. To get file use `event.file`.
`(onFileUploadFinish)="imageUploaded($event)"`. If `[url]` is specified this event is fired when component gets a responce from the server, also in this case event has field `serverResponse` which contains object returned by the server. If `[url]` is not specified it's fired immediately after an image(s) dropped into file-drop zone of choosed in file browser. So what you can do, is not specify `[url]` to handle upload yourself, for exapmple send the image into firebase storage. To get file use `event.file`.

@@ -59,0 +59,0 @@ `(onRemove)="imageRemoved($event)"` - this event is fired when remove button was clicked and the image preview was removed. *Note that this library doesn't handle deletion from server so you should do it yourself*. Event passed as the argument is the exact same object that was passed to the `(imageUploaded)` callback when image was added so you can access `serverResponse` to get a key to delete your image from server.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc