Search code examples
angularng-file-uploadangular5angular-template

angular 5 - ng2-file-upload: Can't bind to 'uploader' since it isn't a known property of 'div'


I read previous questions and the solutions to the answers were already in place, which is why I started another question

I get the following error with ng2-file-upload in Angular 5:

    Uncaught Error: Template parse errors:
Can't bind to 'uploader' since it isn't a known property of 'div'. ("s': hasAnotherDropZoneOver}"
                 (fileOver)="fileOverAnother($event)"
                 [ERROR ->][uploader]="uploader"
                 class="well my-drop-zone">
                Another drop zone
"): ng:///AppModule/UploadComponent.html@25:17
    at syntaxError (compiler.js:466)
    at TemplateParser.parse (compiler.js:24312)
    at JitCompiler._parseTemplate (compiler.js:33699)
    at JitCompiler._compileTemplate (compiler.js:33674)
    at eval (compiler.js:33576)
    at Set.forEach (<anonymous>)
    at JitCompiler._compileComponents (compiler.js:33576)
    at eval (compiler.js:33446)
    at Object.then (compiler.js:455)
    at JitCompiler._compileModuleAndComponents (compiler.js:33445)

I imported and declared the directive into my app.module.ts and the error persisted. Has anyone had this issue with ng-file-upload and angular 5?


Solution

  • FileUploadModule needs to be imported and added to imports in the module declaring the component.

    import { FileUploadModule } from "ng2-file-upload";   //Should import HERE
    
    imports: [  ...FileUploadModule ... ]   //RIGHT PLACE
    

    Angular 2: Can't bind to 'uploader' since it isn't a known property of 'input'