Angular 拖放组件
Angular Drag and Drop component
我尝试在 angular 4 中使用此组件
https://github.com/jellyjs/angular2-file-drop
我有这样的东西
import { Component, OnInit } from '@angular/core';
import { FileDropDirective } from 'angular2-file-drop';
@Component({
selector: 'app-drag-and-drop',
template: `
<div fileDrop
[ngClass]="{'file-is-over': fileIsOver}"
[options]="options"
(fileOver)="fileOver($event)"
(onFileDrop)="onFileDrop($event)">
Drop file here
</div>
`,
directives: [ FileDropDirective ],
styleUrls: ['./drag-and-drop.component.scss']
})
export class DragAndDropComponent implements OnInit {
}
我有错误,从路径导入 FileDropDirective 没有导出成员 'FileDropDirective' 并且行指令中也有错误:[ FileDropDirective ],
对象字面量只能指定已知属性,并且 'directives' 在类型 'Component' 中不存在。
我改
import { FileDropDirective } from 'angular2-file-drop;
to
import { FileDropModule } from 'angular2-file-drop;
还有
directives to providers and working fine
我尝试在 angular 4 中使用此组件 https://github.com/jellyjs/angular2-file-drop
我有这样的东西
import { Component, OnInit } from '@angular/core';
import { FileDropDirective } from 'angular2-file-drop';
@Component({
selector: 'app-drag-and-drop',
template: `
<div fileDrop
[ngClass]="{'file-is-over': fileIsOver}"
[options]="options"
(fileOver)="fileOver($event)"
(onFileDrop)="onFileDrop($event)">
Drop file here
</div>
`,
directives: [ FileDropDirective ],
styleUrls: ['./drag-and-drop.component.scss']
})
export class DragAndDropComponent implements OnInit {
}
我有错误,从路径导入 FileDropDirective 没有导出成员 'FileDropDirective' 并且行指令中也有错误:[ FileDropDirective ], 对象字面量只能指定已知属性,并且 'directives' 在类型 'Component' 中不存在。
我改
import { FileDropDirective } from 'angular2-file-drop;
to
import { FileDropModule } from 'angular2-file-drop;
还有
directives to providers and working fine