Skip to content

Instantly share code, notes, and snippets.

@samirbr
Created November 4, 2015 21:49
Show Gist options
  • Select an option

  • Save samirbr/4c3fa78b7bd8b9edd952 to your computer and use it in GitHub Desktop.

Select an option

Save samirbr/4c3fa78b7bd8b9edd952 to your computer and use it in GitHub Desktop.
<div ng-controller="UploadOptionController">
<!-- $scope must have a method fromFile that receives the content -->
<!-- $scope.fromFile = function(content) { ... }
<div>
<label>Separator</label>
<input type="text" ng-model="upload.needle" name="needle">
<div>
<input class="hide" type="file" ng-model="upload.file" name="file"
onchange="angular.element(this).scope().upload.load().then(angular.element(this).scope().fromFile)">
<button class="md-button md-raised md-primary" aria-label="From file"
ng-click="upload.open($event, 'csv,txt')">
<span translate>From file</span>
</button>
<div>
<small class="info">
TXT or CSV only with columns label and value separated by coma
</small>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment