Angular无法看到或读取ngx-file-drop库
创始人
2024-10-30 01:31:33
0

可能是您没有正确地导入ngx-file-drop模块或在组件中没有正确使用指令。请按照以下步骤进行操作:

1.安装ngx-file-drop库:

npm i ngx-file-drop

2.在您的ngModule中导入FileDropModule:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FileDropModule } from 'ngx-file-drop';

import { AppComponent } from './app.component';

@NgModule({
  imports:      [ BrowserModule, FileDropModule ],
  declarations: [ AppComponent ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

3.在您的组件中使用FileDropDirective指令:

import { Component } from '@angular/core';
import { FileDropDirective, FileUploader } from 'ngx-file-drop';

@Component({
  selector: 'my-app',
  template: '
Drop your files here
' }) export class AppComponent { public uploader:FileUploader = new FileUploader({url:'https://evening-anchorage-3159.herokuapp.com/api/'}); public fileOver(event){ console.log(event); } public fileDrop(event){ console.log(event); } }

这是一个简单的使用ngx-file-drop库的组件示例。希望这可以解决您在Angular中无法看到或读取ngx-file-drop库的问题。

相关内容

热门资讯

透视ai!聚星ai辅助工具下载... 透视ai!聚星ai辅助工具下载(透视)一直是有挂(详细辅助解密教程)1、ai辅助优化,发牌逻辑科技护...
透视新版!德州之星扫描器(透视... 透视新版!德州之星扫描器(透视)都是真的有挂(详细辅助解密教程)1、每一步都需要思考,不同水平的挑战...
透视计算!德扑HHpoker有... 透视计算!德扑HHpoker有挂吗(透视)果然真的有挂(详细辅助详细教程)1、透视辅助简单,软件透明...
透视存在!德普之星透视免费(透... 透视存在!德普之星透视免费(透视)总是有挂(详细辅助黑科技教程)1、进入游戏-大厅左侧-新手福利-激...
透视能赢!hhpoker视频巡... 透视能赢!hhpoker视频巡查真的假的(透视)总是是真的有挂(详细辅助必赢教程)1、玩家可以在软件...
透视代打!德普之星辅助工具如何... 透视代打!德普之星辅助工具如何打开(透视)原来是真的有挂(详细辅助2025教程)1、该软件可以轻松地...
透视数据!wpk官网下载链接(... 透视数据!wpk官网下载链接(透视)果然真的是有挂(详细辅助技巧教程);1、下载好辅助软件之后点击打...
透视规律!aapoker透视脚... 透视规律!aapoker透视脚本(透视)都是有挂(详细辅助2025新版教程)1、完成aapoker透...
透视软件!大菠萝辅助器(透视)... 透视软件!大菠萝辅助器(透视)竟然是有挂(详细辅助安装教程);1、玩家可以在软件透明挂俱乐部对游戏的...
透视教程!wepoker好友助... 透视教程!wepoker好友助力码(透视)真是是真的有挂(详细辅助存在挂教程)1、机器人多个强度级别...