<input type="file" id="file" name="file" ng-show="attachFile" />
<button type="button" ng-model="attach" ng-click="add()">Attach</button>
<div class="panel panel-default" ng-show="displayAttachments">
<div class="panel-heading">
<h3 class="panel-title">Attachments</h3>
</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item">C:\fakepath\angularjs_tutorial.pdf</li>
<li class="list-group-item">display file path using ng-repeat in this panel</li>
</ul>
</div>
</div>
I have a button called attach that calls the add()
function written in my controller, which enables the input of type file.
The functionality is
- Display the choose file button(input type=file) on clicking add
- after choosing file, this choose file must disappear and attachment field appears
- the path of the file must appear in the
li
tag of attachments field which i think can be done using ng-repeat - I must be able to upload another file by the above files and the path of this new file must appear below the path of already chosen file.
My controller has this code
$scope.attachFile = false;
$scope.displayAttachements = false;
$scope.add = function() {
$scope.attachFile = true;
}