I've got a strange problem while using the [uploader] file drop directive from ng2-file-upload. The Angular complier output is:
Can't bind to 'uploader' since it isn't a known property of 'div'.
I searched for any similar Problems on this site, but from my perspective, everything is correct:
the app.module:
[...]
import { SongFilesComponent } from './components/songs/song-files/song-files.component';
import { FileUploadModule } from 'ng2-file-upload';
@NgModule({
declarations: [
[...]
SongFilesComponent
],
imports: [
[...]
FileUploadModule,
AppRoutingModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
SongFilesComponent:
[...]
<div
[uploader]="newFileUploader"
(fileOver)="onFileOverNew($event)"
[class.file-over]="fileOverNew"
>
Drop file here
</div>
[...]
But I always get the described error. I have a second simple test project and the the uploader works. But I can't find any difference between them two.
The whole project is hosted on https://github.com/smuddy/wgenerator/tree/master/WEB
You're missing the component selector that you're trying to use (DIV element is not an angular component, and has not any uploader
Input).
You need to replace :
[...]
<div
[uploader]="newFileUploader"
(fileOver)="onFileOverNew($event)"
[class.file-over]="fileOverNew"
>
Drop file here
</div>
[...]
by
[...]
<div ng2FileDrop
[uploader]="newFileUploader"
(fileOver)="onFileOverNew($event)"
[class.file-over]="fileOverNew"
>
Drop file here
</div>
[...]