angular-js-xlsx
angular-js-xlsx copied to clipboard
How to get the loaded workbook in $scope
Hi, I fail to pass the read workbook to the $scope. How can I do that? I want this, because I don't want to process next actions immediately after I have selected the Excel file, but first want the user to click a 'Proceed' button, or e.g. first show some results of the loaded workbook in some kind of preview. Thanks
Some things I noticed:
- I needed to do
$scope.$apply()
after setting the workbook to a scope variable. Otherwise, the html wouldn't update:
this.$scope.read = function (workbook) {
_this.workbook = workbook;
_this.$scope.$apply();
};
- I like to use a controller alias, like 'vm' in my templates. But the plugin doesn't allow it:
- this works:
<js-xls
onread="read"
onerror="error"></js-xls>
- this doesn't work:
<js-xls
onread="vm.read"
onerror="error"></js-xls>