Can't bind to 'uploader' since it isn't a known native property while using ng2-file-upload #268
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I am getting this error while using ng2fileselect [uploader]
Try adding
FILE_UPLOAD_DIRECTIVESinto your component's directivesSource: http://valor-software.com/ng2-file-upload/
make sure you have it imported in your module
Add FileUploadModule to your module:
Thank you! This fixed it for me
@hetzbr Hi, how do you solved the question about "Can't bind to 'uploader'"? I tried all above the ways,but cant solve the problem .why
I had to add FileUploadModule as an import in my components module
@hetzbr Thank you! FileUploadModule can not be add grandfather module, if it is added,the problem will happen.
Any news here? I'm running into the same issue. I migrated an Angular 2 app from a beta version to the current (2.3.1). Everything went fine but not the fileupload.
My module.ts:
the template:
Error I get:
Can't bind to 'uploader' since it isn't a known property of 'div'
@andreasscheck
You have:
import { FileUploadModule } from 'ng2-file-upload';For version 1.2.0 it should be:
import { FileUploadModule } from 'ng2-file-upload/file-upload/file-upload.module';For version < 1.2.0
import { FileUploadModule } from 'ng2-file-upload/components/file-upload/file-upload.module';upload.module.ts
Thanks for your reply,
actually I tried your suggested import statements before and failed. The Problem was not only the Import but also my template:
old (not working)
new (working):
@hetzbr I just tried that and for some reason it's not solving the issue for me, or rather, it created a new issue. Originally I had the error "Can't bind to 'uploader' since it isn't a known property of 'ng2FileDrop'" much like the original poster. I updated my
FileUploadModuleimport statement as per your comment (I am using ng2-file-upload v1.2.0) but now I have the error:I have checked everywhere and it looks like nothing is out of place and it does compile fine the page just wont load. There definitely isn't an unexpected token, I usually get that error when something else is wrong, and the only change I made to produce that error was changing where
FileUploadModulewas imported from (fromng2-file-uploadtong2-file-upload/file-upload/file-upload.module). Any advice would be appreciated.For my module I have, essentially:
For my component I have:
In my template I have:
In my
systemjs.config.jsfileng2-file-uploadis included like so:I've been trying to get this working for a few hours now but all the little tweaks I make just produce errors where it cannot recognize
ng2FileDropEdit: I just tried modifying my systemjs.config.js to under map to be:
and also included under packages:
And it eliminated the unexpected token error but brought back the "Can't bind to 'uploader' since it isn't a known property of 'ng2FileDrop'" even though I am importing FileUploadModule correctly as per your above comment for ng2-file-upload v1.2.0. Any advice on how to resolve this would be very much appreciated.
Another update: Have also tried loading in systemjs.config.js using the method mentioned 15 days ago in this github issue but am encountering the "Can't bind to 'uploader' since it isn't a known property of 'ng2FileDrop'" error again. However, I suspect the commenter in that github issue is using an older version of
ng2-file-dropbecause of his use of theFILE_UPLOAD_DIRECTIVESand no mention ofFileUploadModule. It seems like there really isn't much information out there, either in the docs or in other github issues I have found that shows how to set this up forng2-file-dropv1.2.0 with systemjs.@NColey
You reference the FileUploader in your component like:
import { FileUploader } from 'ng2-file-upload';You need to reference it as:
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';If you look at the node_modules folder, ng2-file-upload is the folder, ng2-file-upload.d.ts is the typescript definition file in that folder
@hetzbr
Hi, I just updated to import
FileUploaderfrom'ng2-file-upload/ng2-file-upload'and I am still receiving the exact same error message that uploader is not a known property of 'ng2FileDrop'. Isthere another piece I am missing?
@hetzbr If it helps my full setup is here: https://github.com/valor-software/ng2-file-upload/issues/608 as I have made some updates to the code I originally posted yesterday while trying to fix this issue. I am still receiving the same error message about uploader not being a known property of
ng2FileDropeven with the updated code.@NColey
This setup looks very similar to mine, and I don't see anything obviously wrong, can you post the full HTML?
The error showed:
<ng2FileDrop (fileOver)='fileOverAnother($event)' [ERROR ->][uploader]='uploader'> Base Drop Zone </ng2FileDrop>This makes me think it might be something out of place in the HTML
So unfortunately we use haml in this project. I shared the html that it was compiling to above (in my IDE I can see the compiled html file that is being spat out as well as the haml file we edit and work in) because I thought that would make more sense but the haml I have directly in the project looks like this:
I know that haml is kind of a pain sometimes, particularly with figuring out the right way to set it up for angular2 so I even tried just using
as that pretty consistently will point out for me when I am making a haml error vs a component not being recognized but when It's just that (with
fileOveranduploaderand everything else removed I receive this error:Which seems to indicate that somehow the Module or the file drop components themselves are not being recognized (it could still be a haml/html error though but I'm hoping not because haml is such a pain to get right with angular2).
Update: As a test I deleted everything in the template except for the following code (so now the full template is just the ng2FileDrop bit):
And this is the error:
@hetzbr You were definitely right about it being a templating issue, I think I've finally got it (or at least I've got the drop zone to recognize when something has been dragged over it, and if that works I can take it from there) with the following haml:
Thank you so much for catching that it was a templating issue and not a module loading one, I think the errors about the
ng2FileDropcomponent not being recognized were totally setting me in the wrong direction. I appreciate all your help and hopefully the above code will help anyone else who is trying to use haml with ng2FileDrop.@NColey
Oh cool! I wasn't sure how to write a div in HAML, but was trying to test if that was the reason. Glad you got it working! :)