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、许多玩家不知道德...
有挂透视!wepoker私人局... 有挂透视!wepoker私人局怎么玩,小程序微乐辅助器2.0免费,模块教程(今日头条)-哔哩哔哩1、...
普及透视!xpoker透视辅助... 普及透视!xpoker透视辅助,微信微乐辅助器免费安装,攻略教程(果真有挂)-哔哩哔哩一、xpoke...
详情透视!sohoo开挂辅助,... 详情透视!sohoo开挂辅助,微乐南昌辅助神器,手段教程(的确有挂)-哔哩哔哩1、首先打开sohoo...
详情透视!werplan外挂,... 详情透视!werplan外挂,微信微乐陕西小程序破解器,法子教程(有挂功能)-哔哩哔哩1、werpl...
推荐透视!扑克之星辅助,微乐麻... 推荐透视!扑克之星辅助,微乐麻辣自建房辅助视频,项目教程(有挂方略)-哔哩哔哩在进入扑克之星辅助软件...
曝光透视!hhpoker免费透... 曝光透视!hhpoker免费透视脚本,微乐家乡游戏攻略,要领教程(有挂教程)-哔哩哔哩1、玩家可以在...
曝光透视!wepoker透视挂... 曝光透视!wepoker透视挂底牌,小程序微乐辅助器ios,资料教程(有挂细节)-哔哩哔哩1)wep...
曝光透视!wepoker是不是... 曝光透视!wepoker是不是有人用挂,微乐家乡官方免费下载安装,教程书教程(有挂细节)-哔哩哔哩1...
总结透视!wepoker私人局... 总结透视!wepoker私人局辅助挂,小程序微乐陕西挖坑辅助器,演示教程(有挂方法)-哔哩哔哩一、w...