@voxtecnologia/file-upload
v1.0.6
Published
Downloads
5
Readme
1. Install Vox Upload globally:
$ npm install --g @voxtecnologia/file-upload
2. Install Vox Upload in your project devDependencies:
$ npm install --save @voxtecnologia/file-upload
3. Setup Module
Import UploadModule into your app.module.
import { UploadModule } from '@voxtecnologia/file-upload';
@NgModule({
...
imports: [
UploadModule
],
})
4 . Setup Component
Import UploadService into your app.component
import { Component } from '@angular/core';
import { UploadService } from '@voxtecnologia/file-upload';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public title = 'app';
constructor(
private uploadService: UploadService,
) {
public sendFiles() {
this.uploadService.sendFile();
}
}
5 . Setup Angular JSON
- add bootstrap dependency
- add font-awesome
angular.json or .angular-cli.json
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/font-awesome/css/font-awesome.css",
"src/styles.css"
],
6. Setup on View
<app-vox-upload
maxSize="2"
[url]="getUrl"
[fileExt]="getExtesao()"
[anexosRequeridos]="anexos()">
</app-vox-upload>
7. Usage and options
Name | Type | Exemples | Optional | Options Default
--- | --- | --- | ---- | ---
fileExt | String
| jpg, pdf, txt, icon
| Yes | pdf, png, jpeg, jpg, csv, doc, docx
maxSize | number
| 10
| Yes | 2 MB
url | String
| http://localhost:3000/api-file
| No | No
anexosRequeridos | Array
| const anexos = [{}]
| No | No