Here is my angularjs code:
$scope.attachments = [];
$scope.uploadFile = function(files){
for(var i=0; i<files.length; i++){
$scope.attachments.push(files[i]);
console.log($scope.attachments.length);
}
};
Here is the html code:
<input multiple ng-class="{true:'btn btn-success', false:'btn btn-danger'
[fileUploadedStatus]" style="width:15em" type="file" name="file"
onchange="angular.element(this).scope().uploadFile(this.files)"/>
{{attachments.length}}
<ul>
<li ng-repeat="attachment in attachments">
attachment: {{attachment.name}}
</li>
</ul>
I am trying to list out all the files. But the $scope.attachments variable won't update, i can see in the console log the attachments.length get's 1 and 2 and so on, but on the page it's always 0.