Browse Source

Clear input type file value for uploaded pictures on cancel.

pull/140/head
Evan Theurer 11 years ago
parent
commit
3d8dc4c120
  1. 4
      static/js/directives/buddypictureupload.js

4
static/js/directives/buddypictureupload.js

@ -124,6 +124,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi @@ -124,6 +124,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi
$scope.imgData = null;
$scope.prevImage.src = "";
$scope.prevImage.style.cssText = null;
$scope.clearInput();
};
$scope.cancelPictureUpload = function() {
@ -203,6 +204,9 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi @@ -203,6 +204,9 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi
var link = function($scope, $element) {
$scope.prevImage = $element.find("img.preview").get(0);
$scope.clearInput = function() {
$element.find("input[type=file]")[0].value = "";
};
// Bind change event of file upload form.
$element.find("input[type=file]").on("change", $scope.handlePictureUpload);

Loading…
Cancel
Save