-
Notifications
You must be signed in to change notification settings - Fork 660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
is ng2-file-upload now supports angular 4 ? #742
Comments
Yes, It is. Import these directives to your module: import { FileDropDirective, FileSelectDirective } from 'ng2-file-upload';
@NgModule({
declarations: [FileDropDirective, FileSelectDirective]
})
export class AppModule { } Then create file uploader in your component: import { Component, OnInit } from '@angular/core';
import { FileUploader } from 'ng2-file-upload';
@Component({
selector: 'app-files',
templateUrl: 'files.component.html',
styleUrls: ['files.component.css'],
})
export class FilesComponent implements OnInit {
uploader = new FileUploader({url: `YOUR URL`});
} And use it in your html file: <div ng2FileDrop [uploader]="uploader">
<input type="file" ng2FileSelect [uploader]="uploader" multiple /> |
@kacepe doing like you said, webpack can't compile saying that FileDropDirective is part of the declarations of 2 modules: FileUploadModule and AppModule. It says to consider moving FileDropDirective to a higher module that imports FileUploadModule and AppModule. Edit: So just looked around in the issues and it seems that it's enough to import the whole module:
|
@kacepe I am facing same issue reported by the @luiscvalmeida. @luiscvalmeida Did you got Angular 4 working with ng2-file-upload? |
@railslauncher No I didn't, I gave up and built my own file uploader. |
My file uploaders were working fine on Angular 2.x. I updated Angular to 4.0.0 and now I'm getting this error. |
I'm getting a similar issue as @luiscvalmeida. ng serve works OK but if I try to build the project it throws a similar 'file-select.directive.d.ts is part of the declarations of 2 modules' error. Anyone got around this? |
when I'm trying to install "npm install ng2-file-upload --save" in my angular 4 application it throws UNMET PEER DEPENDENCY @angular/common@4.1.0 can someone help me on this please... |
Any solution to this? |
We don't have a working Package for file-upload in angular 4, if you want you have to do it by yourself..!!!! |
I just got one stepfurther. It compiles and the page can be viewed. I added the FileSelectDirective declaration inside my child module 'client.module'. NOT inside the app.module. |
@luiscvalmeida bit of a newbie here, any chance you're able to share the angular 4 directive you wrote for file upload? I have a post request that takes a form-data file parameter. Struggling to get the input file into the post parameter. |
it works for me out of the box using Angular 4.0.0. Only issue im having now is that I cant build for production using |
I checked many and finally came out with this It works like charms for me without any third party control with configurable properties like size, extension, max files with extra data. |
It supports Angular 4 now. Using it in a project with this and it gets the job done. |
It does not support angular 4. You should not have close this trail. Thank you |
I have it running in an application with 4.4.3. If you have some specific problem please open an issue with more details about it. |
The Same error as reported above: After following the documentation and doing as stated import { FileDropDirective, FileSelectDirective } from 'ng2-file-upload'; import { Component, OnInit } from '@angular/core';
Base drop zone
I am runing Angular 4.3.5. on ubuntu 16.04 The reality here is that no one has said on this trail that they are able to make it work apart from @adrianfaciu, and neither did @adrianfaciu show us anything he did to make it work. so I do not believe this trail should be closed without doing justice to the purpose for which it is started in the first place. |
@hiroyalty some of the comments specify that you need to import the module. Similar to other libraries you might be using |
if support ,how to update ?
thanks very much !
The text was updated successfully, but these errors were encountered: