sachin yadav
sachin yadav

Reputation: 367

bind data to angular.js controller

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

Answers (1)

Mumin Korcan
Mumin Korcan

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

Related Questions