Fix a script error which is occurred when choosing no file
In swift container panel, when a user select no file with opening file select dialog, error will occur because in that case there are no file info. This patch will fix it. Change-Id: Ib6e381e9af97837f6aae8df9d9564eee76304670 Closes-Bug: #1636340
This commit is contained in:
parent
87a888c0a2
commit
2fbf3fbdf3
|
@ -59,7 +59,9 @@
|
|||
// to have angular pick up that the file upload now has a value
|
||||
// and any required constraint is now satisfied
|
||||
scope.$apply(function expression() {
|
||||
ngModel.$setViewValue(event.target.files[0].name);
|
||||
var files = event.target.files;
|
||||
var filename = files && files.length > 0 ? files[0].name : null;
|
||||
ngModel.$setViewValue(filename);
|
||||
ngModel.$render();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue