I am new to angularjs and trying to implement simple file upload but I am fetting file as undefined while trying to access it from controller
articles.html
<section data-ng-controller="ArticlesController" data-ng-init="find()">
<div class="page-header">
</div>
<div >
<input type="file" file-model="myFile"/>
<button ng-click="uploadFile()">upload me</button>
</div>
</section>
following is my controller where I am trying to access file object
angular.module('articles').controller('ArticlesController', ['$scope', '$stateParams', '$location','Authentication', 'Articles',
function($scope, $stateParams, $location, Authentication, Articles) {
$scope.authentication = Authentication;
$scope.uploadFile = function() {
console.log('came here');
var file = $scope.myFile;
console.log('file is ' + file);
};
}
]);
Edit:
I tried using https://github.com/ghostbar/angular-file-model and working on meanjs boiler plate code
One of the step is to include angular-file-model.js in html page. Add to your HTML files:
in which file do I include and how do I include the angular-file-model.js file.