Reputation: 367
I am trying to bind file input type data to the angular.js controller but after submit the data is undefined.
<input type="file" name="image" class="form-control upload " ng-model="image" value="upload">
<input type="submit" ng-click="uploadimage()" value="upload" class="btn btn-default">
angular js controller is
//upload image
$scope.uploadimage = function() {
console.log($scope.image);
}
Upvotes: 0
Views: 98
Reputation: 101
The file input type is missing from the ng-model directive, so you need to install a package for file uploads with AngularJS.
Upvotes: 1