I'm really new to AngularJS and I've found that ng-model doesn't work for a file type input tag. I want to be able to allow users to upload pictures to my app, but nothing I've tried so far has worked. I've tried to use both ng-file upload and angular-file upload, but they both require dependency injection and whenever I try that my entire app crashes. I've been reading that a new directive can be created, but I am so new to Angular that I'm not understanding how to do that. Any insight would be great!
postImage.html :
<div id="postimage container" >
<div >
<input type="file" name="image" np-model="$ctrl.image"/>
<button ng-click="$ctrl.upload($ctrl.image)">Upload</button>
</div>
postimage.js :
angular.module('main')
.component('postimage', {
controller: function () {
this.upload = function (data) {
console.log(data)
}
},
templateUrl: '../templates/postImage.html'
});