Skip to content

Commit

Permalink
x
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin Apple committed Apr 21, 2018
1 parent c3d6031 commit 0701a0c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo/www/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/file-upload/ngf.directive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export declare class ngf {
name: string;
fn: (file: File) => boolean;
}[];
lastFileCount: number;
multiple: string;
accept: string;
maxSize: number;
Expand Down
5 changes: 4 additions & 1 deletion dist/file-upload/ngf.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var ngf = (function () {
function ngf(element) {
this.element = element;
this.filters = [];
this.lastFileCount = 0;
//@Input() forceFilename:string
//@Input() forcePostname:string
this.ngfFixOrientation = true;
Expand Down Expand Up @@ -138,6 +139,8 @@ var ngf = (function () {
.then(function (url) { return _this.lastBaseUrlChange.emit(url); });
}
}
//will be checked for input value clearing
this.lastFileCount = this.files.length;
};
/** called when input has files */
/** called when input has files */
Expand Down Expand Up @@ -165,7 +168,7 @@ var ngf = (function () {
return false;
};
ngf.prototype.beforeSelect = function () {
if (this.files.length)
if (this.lastFileCount === this.files.length)
return;
//if no files in array, be sure browser doesnt prevent reselect of same file (see github issue 27)
this.fileElm.value = null;
Expand Down
2 changes: 1 addition & 1 deletion dist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"main": "index.js",
"version": "0.5.2",
"version": "0.5.3",
"description": "Angular file upload directives",
"module": "index.js",
"typings": "index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-file",
"version": "0.5.2",
"version": "0.5.3",
"private": true,
"description": "Angular file upload directives",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion src/file-upload/ngf.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { acceptType, InvalidFileItem, applyExifRotation, dataUrl } from "./fileT
export class ngf {
fileElm:any
filters:{name:string, fn:(file:File)=>boolean}[] = []
lastFileCount:number=0

@Input() multiple:string
@Input() accept:string
Expand Down Expand Up @@ -168,6 +169,9 @@ export class ngf {
.then( url=>this.lastBaseUrlChange.emit(url) )
}
}

//will be checked for input value clearing
this.lastFileCount = this.files.length
}

/** called when input has files */
Expand Down Expand Up @@ -199,7 +203,7 @@ export class ngf {
}

beforeSelect(){
if( this.files.length )return
if( this.lastFileCount===this.files.length )return
//if no files in array, be sure browser doesnt prevent reselect of same file (see github issue 27)
this.fileElm.value = null
}
Expand Down

0 comments on commit 0701a0c

Please sign in to comment.