在使用来自 ng2-file-upload 的 [uploader] 文件删除指令时,我遇到了一个奇怪的问题。Angular 编译器的输出是:
无法绑定到“上传器”,因为它不是“div”的已知属性。
我在这个网站上搜索了任何类似的问题,但从我的角度来看,一切都是正确的:
- 在 app.module 中声明组件 - 检查
- 在同一个 app.module 中导入 FileUploaderModule - 检查
- 没有其他模块(除了路由)
应用程序模块:
[...]
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 {}
SongFiles 组件:
[...]
<div
[uploader]="newFileUploader"
(fileOver)="onFileOverNew($event)"
[class.file-over]="fileOverNew"
>
Drop file here
</div>
[...]
但我总是得到描述的错误。我有第二个简单的测试项目,上传器工作。但我找不到他们两个之间的任何区别。