I have an item in an object c.data.requiredAttachmentUploaded = false
I need to make it "true" when a file is selected in <input type="file" >
So I am trying to do it with ng-change but it's not working, even console.log is not working. Is ng-change is appropriate for this task ?
APP.JS
app.controller('taskSummaryAndAction', [
function() {
c = this; //declare c internally
c.data = {}; //setup our data object (To be used in later steps)
c.data.requiredAttachmentUploaded = false;
c.attachmentChange = function() {
console.log('Hello');
c.data.requiredAttachmentUploaded = true;
};
}
]);
HTML
<div ng-controller="taskSummaryAndAction as c">
Input File here :
<input type="file" ng-change="attachmentChange()"
ng-model="c.data.requiredAttachmentUploaded">
</div>
I can easily do this with jQuery but I need to do this with AngularJS. I m not even getting an error in Console.