javascript - e.target.result empty in angular cli -
i need upload file system. worked, after moved angular cli, started give trouble. here's code:
reader.onload = function(e: any) { var data = e.target.result; console.log(data); var result; var workbook = xlsx.read(data, { type: 'binary' }); var sheet_name_list = workbook.sheetnames; /* iterate through sheets */ sheet_name_list.foreach( function(y) { //convert cell value json var roa = xlsx.utils.sheet_to_json(workbook.sheets[y]); if (roa.length > 0) { result = roa; } }); result.foreach( element => { if (element.permissao == "2") { element.permissao = "usuário comum"; } else if (element.permissao == "1") { element.permissao = "administrador"; } }); //get first column first cell value; _component.validationfiles(result); };
in console.log(data)
, looks this: arraybuffer {}
and when call readasarraybuffer(f)
, error:
error typeerror: f.charcodeat not function
Comments
Post a Comment