i have a problem when accessing scope parameter inside an image onload
event. i am using to upload an image and validate his size
$scope.onFileSelect = function ($files) {
$scope.loading = true;
//$files: an array of files selected, each file has name, size, and type.
file = $files[0];
var img = new Image();
img.src = _URL.createObjectURL(file);
img.onload = function () {
if (this.width > sizes.width && this.height > sizes.height) {
console.log("good size");
} else {
console.log("check the sizes of your image");
$scope.loading = false;
}
};
but the $scope.loading will remain the same after the the onload block instead
of being equal to false.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.