1

I am new to angular js and am trying to create a simple file uploading element. Following is my angular js code

<div class="input-group input-group-sm" id="fileUploader">
        <span class="input-group-btn">
            <span class="btn btn-primary btn-file">
                Browse<input type="file" ngf-select ng-model="csvFile" name="file" accept=".csv"></input>
            </span>
        </span>         
        <input type="text" id="fileInput" class="form-control" placeholder="Choose file" readonly></input>
        <span class="input-group-btn">
            <button class="btn btn-primary" type="submit">Ok</button>
        </span>
    </div>

When I click on browse button and choose a file, I want the file name to appear on the fileInput element. Can anyone help me on how to do that?

1 Answer 1

1

In your 'fileinput' input try setting value={{csvFile.name}}. This should work if you have everything dependency injected correctly & all that.

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.