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

相关内容

热门资讯

1分钟带你辅助!广东雀神智能插... 广东雀神智能插件辅助 无需打开直接搜索微信:136704302本司针对手游进行,选择我们的四大理由:...
第一分钟带你详情!杭州都莱辅助... 第一分钟带你详情!杭州都莱辅助软件有没有用,花花生活圈怎么装开挂,详细教程(有挂教学)-哔哩哔哩您好...
1分钟带你辅助!新鸿狐挂机,新... 新上游辅助器是一款可以让一直输的玩家,快速成为一个“必胜”的ai辅助神器,有需要的用户可以加我微信(...
第8分钟带你讲究!凑一桌游戏关... 第8分钟带你讲究!凑一桌游戏关春天破解透视版,蛮王大厅辅助,教你攻略(新版有挂)-哔哩哔哩;无需打开...
第九分钟带你明白!创思维透视下... 第九分钟带你明白!创思维透视下载链接,创思维激k看底牌辅助软件,必备教程(有挂总结)-哔哩哔哩创思维...
六分钟带你发现!哥哥打大a辅助... 【亲,福建天天开心辅助工具 这款游戏可以开挂的,确实是有挂的,很多玩家在这款福建天天开心辅助工具中打...
3分钟带你讲解!乐达大连穷胡小... 大家好,今天小编来为大家解答乐达大连穷胡小鸡满天飞这个问题咨询软件客服可以免费测试直接加微信(136...
四分钟带你透视!789大菠萝攻... 789大菠萝攻略开挂教程视频分享装挂详细步骤在当今的网络游戏中,789大菠萝攻略作为一种经典的娱乐方...
9分钟带你讲解!丽水都莱脚本辅... 9分钟带你讲解!丽水都莱脚本辅助,福建天天开心辅助工具,教你攻略(有挂教程)-哔哩哔哩 >>您好:软...
第4分钟带你明白!福建大玩家透... 第4分钟带你明白!福建大玩家透视,赣牌圈有挂吗,辅助教程(有挂总结)-哔哩哔哩福建大玩家透视ai黑科...