Search code examples
angularjstypescriptng-file-upload

how to import ng-file-upload


I am trying to import module from @types/ng-file-upload/index.d.ts which contains

declare var angularFileUploadDefaultExport: string;
export = angularFileUploadDefaultExport;

declare module 'angular' {
    export namespace angularFileUpload {
        interface ImageDimensions {

        }
    }
}

now if i import it like below

    import * as ngFileUpload from 'ng-file-upload';
    or
    import 'ng-file-upload';
    or
    import ngFileUpload = require('ng-file-upload');

but webpack is still giving error while trying to access ngFileUpload.ImageDimensions

what is the correct way to import packages defined with module??


Solution

  • given that it is defined inside the angular modules declare module 'angular' { there is no need to import it... just directly use it as angular.angularFileUpload