0

I am trying to pass a variable to a function in my javascript. When I look at the button in the developer tools, the variable is set to the value that I expect, the name of the file. If I set a breakpoint in the javascript and look at the attachmentName variable that looks fine in the developer tools for the HTML, it comes out as {{vm.requisition.pOR_Detail.attachment_Name}} instead of the name of the file. What can I do to pass the correct value?

HTML

<button class="col-xs-3" class="btn btn-default"
        data-ng-show="vm.requisition.requisitioner === vm.currentUser.username"
        data-ng-click="deleteAttachment('{{vm.requisition.pOR_Detail.attachment_Name}}')"
        type="button">Remove Attachment</button>

JavaScript

$scope.deleteAttachment = function (attachmentName) {
    Upload.upload({
        url: '../../DeleteHandler.ashx',
            data: { attachmentName: attachmentName }
        }).then(function (resp) {
            console.log('File deleted. Response: ' + resp.data);
        }, function (resp) {
            console.log('Error status: ' + resp.status);
    });
};
georgeawg
  • 48,608
  • 13
  • 72
  • 95
sjohn285
  • 385
  • 5
  • 20

1 Answers1

2

drop the interpolation and quotes from function call

<button data-ng-click="deleteAttachment(vm.requisition.pOR_Detail.attachment_Name)" type="button">Remove Attachment</button>
chrystian
  • 831
  • 7
  • 15