Skip to content

Commit ea3306f

Browse files
committed
Added convert to text directive
1 parent f2974aa commit ea3306f

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fctrlx-file-to-base64",
3-
"version": "0.0.3",
3+
"version": "0.0.4",
44
"peerDependencies": {
55
"@angular/common": "^7.2.0",
66
"@angular/core": "^7.2.0"
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { NgModule } from '@angular/core';
22
import { FctrlxFileToBase64Directive } from './fctrlx-file-to-base64.directive';
3+
import { FctrlxFileToTextDirective } from './fctrlx-file-to-text.directive';
34

45
@NgModule({
56
imports: [],
6-
declarations: [FctrlxFileToBase64Directive],
7-
exports: [FctrlxFileToBase64Directive],
7+
declarations: [FctrlxFileToBase64Directive, FctrlxFileToTextDirective],
8+
exports: [FctrlxFileToBase64Directive, FctrlxFileToTextDirective],
89
})
910
export class FctrlxFileToBase64 { }
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {
2+
Directive,
3+
ElementRef,
4+
EventEmitter,
5+
Input,
6+
Output,
7+
} from '@angular/core';
8+
import { Base } from './Base';
9+
10+
@Directive({
11+
selector: '[fileToText]',
12+
})
13+
export class FctrlxFileToTextDirective extends Base {
14+
@Input() files: any;
15+
@Input() type: string;
16+
@Input() multiple: undefined | null | string | boolean;
17+
18+
@Output() filesChange: EventEmitter<any> = new EventEmitter();
19+
20+
constructor(element: ElementRef) {
21+
super('fileToText', element);
22+
}
23+
24+
filesChanged(event: Event): void {
25+
super.filesChanged(event, 'readAsText', 'text');
26+
}
27+
}

0 commit comments

Comments
 (0)