ng2 file upload - Angular 2: Can't bind to 'uploader' since it isn't a known property of 'input' -
im trying integrate ng2-file-upload module application.
and im getting template error: can't bind 'uploader' since isn't known property of 'input'
update folder str:
/src/app/app.module.ts /src/app/components/layout/ layout.module.ts other layout components files /category-items category-items.module.ts category-items.component.ts
in layout.module.ts
import { layoutcomponent } './layout.component'; declarations: [ layoutcomponent,
in category-items.module.ts
import { categoryitemscomponent } './category-items.component'; import {fileuploadmodule} "ng2-file-upload"; imports: [ ...fileuploadmodule ... ]
app\app.module.ts
import {fileuploadmodule} "ng2-file-upload"; imports: [ ...fileuploadmodule ... ]
app\components\layout\category-items\category-items.component.ts
import { fileuploader } 'ng2-file-upload'; @component({ selector: 'button-view', template: ` <input type="file" class="form-control" name="single" ng2fileselect [uploader]="uploader" /> ` }) export class buttonviewcomponent implements viewcell, oninit { ... public uploader:fileuploader = new fileuploader({url:'http://lcoalhost:5000/upload'}); } @component({ selector: 'app-category-items', templateurl: './category-items.component.html', styleurls: ['./category-items.component.scss'] }) export class categoryitemscomponent implements oninit { ... }
or if try out below: unexpected closing div tag
<div ng2filedrop (fileover)-'fileoverbase($event)' [uploader]="uploader" class="well my-drop-zone"> base drop zone </div>
i have tried multiple combinations of imports 'fileuploadmodule' in app.module in various posts, none seems work in case.
error stack trace:
"uncaught (in promise): error: template parse errors:↵can't bind 'uploader' since isn't known property of 'input'. ("↵ ↵
have googled many posts solutions same:
some of references were: (but none helping)
https://github.com/valor-software/ng2-file-upload/issues/418
https://github.com/valor-software/ng2-file-upload/issues/608
you need import fileuploadmodule
in module declares component using 'upload'
in case category-items.module.ts
category-items.module.ts
import { categoryitemscomponent } './category-items.component'; import { fileuploadmodule } "ng2-file-upload"; //should import here imports: [ ...fileuploadmodule ... ] //right place
Comments
Post a Comment