Need private packages and team management tools?Check out npm Teams »


1.2.5 • Public • Published


Angular 2+ wrapper for Uploadcare Widget.

NPM version Build Status Uploadcare stack on StackShare

Uploadcare Widget is an HTML5 file uploader, a part of the Uploadcare ecosystem.


npm install ngx-uploadcare-widget


The basic wrapper usage scenario can be described in four steps.

Step 1. Import the module

import { UcWidgetModule } from 'ngx-uploadcare-widget';

Step 2. Import the module to yours

  imports: [

Step 3. Use the component in your template

<!-- with default markup -->
<!-- without any markup -->

Step 4. Have fun with the widget events

The component currently supports three widget events:

  • on-change
  • on-upload-complete
  • on-progress

Here is how you can handle those three,


You can learn more about this widget events in our docs.


Supported input attributes

All the following attributes correspond to the ones listed in the widget docs, but without the data- prefix.


Events usage example:

  onUpload(info) {
    console.log('fired Event "onUpload"');
  onProgress(progress) {
    console.log('fired Event "onProgress with data:"');
  onChange(file) {
    if(!file) {
    console.log('fired Event "onChange"');
  // input file parameter depends on "multiple-files" widget attribute
    if(this.multipleFiles) {
  //  file contains 2 methods:
  //  .promise() - returns the general promise for all uploaded files which resolves into an uploaded file group info
  //  .files() - returns an array of promises: one per each uploaded file. Each promise resolves into an uploaded file info
      if(file.promise) {
        file.promise().then((groupInfo) => {
          console.log('resolved general promise from "onChange" with data:');
      if(file.files) {
        file.files().forEach((promise) => {
          promise.then((fileInfo) => {
            console.log('resolves file promise with file info:');
      } else {
  // file contains uploaded file info


The components provides following public methods:

  • clearUploads() - Removes all current uploads from the widget. You can use the method to reset a form even if a user has already uploaded some files.
  • reset(clearUploads = false) - Resets the widget, You can also remove all the current uploads if clearUploads is set to true
  • openDialog() - Opens Uploadcare widget dialog with current configuration.
  • reject() - Closes the dialog opened with openDialog() method only and discards any file selection.

All methods are accessible from a parent component via the @ViewChild() approach.


It is possible that your locale is not available in the widget yet. If that’s the case, contributing your locale might be a good idea. This can be done by forking the main repository and adding a localization file here.

The quick way of implementing your locale would be overriding any of the existing ones via the UPLOADCARE_LOCALE_TRANSLATIONS property.

Security issues

If you think you ran into something in Uploadcare libraries which might have security implications, please hit us up at or Hackerone.

We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.


Issues and PRs are welcome. You can provide your feedback or drop us a support request at


npm i ngx-uploadcare-widget

DownloadsWeekly Downloads






Unpacked Size

272 kB

Total Files


Last publish


  • avatar
  • avatar