<pre> var app=angular.module("myModule",[]); app.controller("myController",function($scope){ var excelJsonObj=[]; $scope.data={}; $scope.uploadExcel=function(){ var myfile=document.getElementById('file') var input=myfile var reader=new FileReader(); reader.onload=function(){ var filedata=reader.result var workbook=XLSX.read(filedata, {type:'binary'}); workbook.SheetNames.forEach(function(sheetName){ var rowObject=XLSX.utils.sheet_to_row_object_array(workbook.Sheets[sheetName]); excelJsonObj=rowObject; }); var info1=excelJsonObj[0].Birthday $scope.data.info=info1 // Here I see the value in the console console.log($scope.data.info) } // Here I don't see the value reader.readAsBinaryString(input.files[0]); if($scope.data.info){ console.log($scope.data.info) } }; })
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)