Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
angular2-dropzone-wrapper
Advanced tools
Readme
This is an Angular 2 wrapper library for Dropzone.
See a live example application here.
npm install
npm run build
cd example
npm install
npm start
npm install angular2-dropzone-wrapper --save-dev
import { DropzoneModule } from 'angular2-dropzone-wrapper';
import { DropzoneConfigInterface } from 'angular2-dropzone-wrapper';
const DROPZONE_CONFIG: DropzoneConfigInterface = {
// Change this to your upload POST address:
server: 'https://httpbin.org/post',
maxFilesize: 50,
acceptedFiles: 'image/*'
};
@NgModule({
...
imports: [
...
DropzoneModule.forRoot(DROPZONE_CONFIG)
]
})
This library provides two ways to create a Dropzone element, simple component and custom directive.
COMPONENT USAGE
Simply replace the element that would oridinarily be passed to Dropzone
with the dropzone component.
<dropzone [config]="config" [message]="'Click or drag images here to upload'" (error)="onUploadError($event)" (success)="onUploadSuccess($event)"></dropzone>
[config] // Custom config to override the global defaults.
[message] // Message to show for the user on the upload area.
[placeholder] // Placeholder image to be shown as the upload area.
(error) // Event handler for the dropzone upload error event.
(success) // Event handler for the dropzone upload success event.
(canceled) // Event handler for the dropzone upload canceled event.
DIRECTIVE USAGE
When using only the directive you need to provide your own theming or import the default theme:
@import 'https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.3.0/dropzone.min.css';
Dropzone directive can be used with form or div element with optional custom configuration:
<div [dropzone]="config" (error)="onUploadError($event)" (success)="onUploadSuccess($event)"></div>
[dropzone] // Can be used to provide optional custom config.
(error) // Event handler for the dropzone upload error event.
(success) // Event handler for the dropzone upload success event.
(canceled) // Event handler for the dropzone upload canceled event.
This library supports all Dropzone configuration options and few custom extra options for easier usage.
LIBRARY OPTIONS
server // Server url for sending the upload request (Default: '').
params // Url parameters to be added to the server url (Default: null).
autoReset // Time for resetting component after upload (Default: null).
errorReset // Time for resetting component after an error (Default: null).
cancelReset // Time for resetting component after canceling (Default: null).
DROPZONE OPTIONS
method // HTTP method to use communicating with the server (Default: 'post').
headers // Object of additional headers to send to the server (Default: null).
paramName // Name of the file parameter that gets transferred (Default: 'file').
maxFilesize // Maximum file size for the upload files in megabytes (Default: null).
acceptedFiles // Comma separated list of mime types or file extensions (Default: null).
For more detailed documentation with all the supported dropzone options see Dropzone documentation.
FAQs
Angular 2 wrapper library for Dropzone
The npm package angular2-dropzone-wrapper receives a total of 25 weekly downloads. As such, angular2-dropzone-wrapper popularity was classified as not popular.
We found that angular2-dropzone-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.