Skip to content

Commit 9f23845

Browse files
authored
Fixed nonce integration with file upload
1 parent dee613d commit 9f23845

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

knowage/src/main/webapp/js/src/angular_1.4/tools/commons/upload-file/FileUpload.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ angular.module('file_upload', [ 'ngMaterial', 'sbiModule'])
2323
controllerAs: 'ctrl',
2424
link: function(scope, element, attrs, ctrl, transclude) {
2525

26+
var input = element.find('input')[0];
27+
input.addEventListener('change', function () {
28+
scope.ctrl.setFile(this);
29+
});
30+
31+
2632
scope.id = "fileUpload" + Math.floor(Math.random() * 1000);
2733
if (attrs.id){
2834
scope.id = attrs.id;
@@ -41,7 +47,8 @@ angular.module('file_upload', [ 'ngMaterial', 'sbiModule'])
4147

4248

4349
function FileUploadControllerFunction($scope,$timeout,$mdDialog,sbiModule_translate){
44-
$scope.setFile = function (element){
50+
var vm = this
51+
vm.setFile = function (element){
4552

4653
var max = $scope.fileMaxSize != undefined ? $scope.fileMaxSize : defaultFileMaxSize;
4754

knowage/src/main/webapp/js/src/angular_1.4/tools/commons/upload-file/template/file-upload.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<label ng-disabled='ngDisabled' id="{{id}}" class="md-button md-knowage-theme md-raised md-ExtraMini" md-ink-ripple for="{{id}}_input">
44
<span >{{textButton}}</span>
55
</label>
6-
<input ng-disabled='ngDisabled' id="{{id}}_input" type="file" class="ng-hide" onclick="this.value=null" onchange='angular.element(this).scope().setFile(this)'/>
6+
<input ng-disabled='ngDisabled' id="{{id}}_input" type="file" class="ng-hide" onclick="this.value=null"/>
77
<md-input-container flex='ngDisabled' >
88
<input type='text' disabled ng-model="fileName" aria-label="file name"/>
99
</md-input-container>

0 commit comments

Comments
 (0)