angular-js-xlsx icon indicating copy to clipboard operation
angular-js-xlsx copied to clipboard

How to get the loaded workbook in $scope

Open eugenevk opened this issue 7 years ago • 1 comments

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

eugenevk avatar Feb 23 '18 10:02 eugenevk

Some things I noticed:

  1. 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();
            };
  1. 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>

two-bridges avatar Mar 08 '18 22:03 two-bridges