I have the following problem. The $watch event gets called when I manually select a file. But when I do it by using the following
$scope.clear = function() {
$scope.logo = null;
};
it doesn't fire the event. Any ideas?
Here's the plunkr
I have the following problem. The $watch event gets called when I manually select a file. But when I do it by using the following
$scope.clear = function() {
$scope.logo = null;
};
it doesn't fire the event. Any ideas?
Here's the plunkr
the problem is with input type file. the input type[file] does not get reset as other inputs do.
please read more about this here and here.
the suggested solution is:
<input type="file" id="control"/>
and corrosponding js
var control = $("#control");
$("#clear").on("click", function () {
control.replaceWith( control = control.clone( true ) );
});
you can always write a directive which would make it much more reusable.