README
Lnl Save Files
This package is built for select files to upload in REST Angular application
Installation
- run
npm install --save lnl-save-files
- in AppModule
...
import { LnlSaveFilesModule } from 'lnl-save-files'; <========== import here
import { ToastrModule } from 'ngx-toastr';
import {NoopAnimationsModule, BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatButtonModule, MatDialogModule, MatFormFieldModule} from '@angular/material';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
...
LnlSaveFilesModule, <========== import here
BrowserAnimationsModule,
NoopAnimationsModule,
MatButtonModule,
MatFormFieldModule,
MatDialogModule,
ToastrModule.forRoot(),
...
],
providers: [],
entryComponents: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
3. in app.component.ts
```typescript
import { MatDialog } from '@angular/material';
import { LnlSaveFilesComponent } from 'lnl-save-files'; <========== import here
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'app';
constructor(private dialog: MatDialog,
private toastr: ToastrService){
}
choseFile(){
const dialogRef = this.dialog.open(LnlSaveFilesComponent, {
maxWidth: '768px',
maxHeight: '500px',
data: {name: 'name_of_file_request', multiple: false, type: '.pdf, .doc, .docx',
filename: 'filenameOfFile', url: `http://backend/api/url/request`}
});
dialogRef.afterClosed().subscribe(result => {
});
}
}
```
### Dependencies
1. ngx-bootstrap
2. jquery
3. angular material
4. ngx-toastr
## Configuration
Passez les parametres dans l'objet data du modal de angular material.
les parametres sont:
- titre: set the title of modal
- type: set files accept ex:('.doc, .pdf')
- url: set the url of request
- filename: set a filename for your request
- name: name for your request
- multiple: is true or false.
- callback_submit: is a callback function called if url undefined. parareters => (file: File, save_file: SaveFile)