1

This is the code.

<button ngf-select ng-model="b.files" class="btn btn-success btn-sm" ng-click="uploadMode=1">
    <span class="glyphicon glyphicon-picture"></span> Pick Image
</button>

<input type="text" ng-model="f.name" value="b.files[0].name"><br><br>

<ul>
    <li>{{b.files[0].name}}</li>
</ul>

When user selecting a file to upload, it is displaying in ul - li. But i want same file name to be displayed in text box also. For that i am setting text box value to value="b.files[0].name". But its not working.

Any help on this?

1 Answer 1

1

EDIT: Value is always overwritten by ng-model if present, so you should use this:

<input type="text" ng-model="b.files[0].name">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.