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库的问题。

相关内容

热门资讯

WPK安装辅助妙招!wepok... WPK安装辅助妙招!wepoker模拟器哪个,WePoKerai多功能辅助脚本1、进入游戏-大厅左侧...
推荐十款!透视!多乐麻将ai透... 推荐十款!透视!多乐麻将ai透视多功能插件,其实有透视安装妙计;近期一款 AI 黑科技工具火爆出圈,...
WPK安装辅助指引!wepok... WPK安装辅助指引!wepoker有没有插件,wpkai多功能辅助方法1、wepoker有没有插件有...
玩家必看教程辅助!微乐浙江麻将... AI 黑科技赛道又上新,这款智能处理工具堪称效率开挂,专门面向短视频创作者打造。它打通脚本撰写、AI...
WPK下载透视手册!wepok... WPK下载透视手册!wepoker破解器有用吗,wpkai多功能透视插件1、下载好wepoker破解...
实操分享辅助挂!非常竞技ai辅... 您好,实操分享辅助挂!非常竞技ai辅助挂多功能插件,最初有辅助挂平台办法这款游戏可以开挂的,确实是有...
WPK官网辅助练习!德普之星透... WPK官网辅助练习!德普之星透视辅助软件激活码,AApokerai多功能辅助工具一、德普之星透视辅助...
一分钟了解辅助挂!约战荆门麻将... 约战荆门麻将AI 游戏攻略黑科技上线本地缓存功能,离线查阅能力开挂。提前下载对应游戏攻略数据包,断网...
WPK真假透视挂操作!有哪些免... WPK真假透视挂操作!有哪些免费的wpk作弊码,红龙PoKerai多功能透视挂工具1、有哪些免费的w...
细节方法辅助!聚游广东麻将ai... 很多人使用云端 AI 时,都担心聚游广东麻将、内部资料上传带来隐私风险。这款本地运行的 AI 黑科技...