1

I have a series of comment inputs that repeat. When I start typing in one, all inputs are populated with the characters I am typing.

How do I have the text input value only populate in the text input I am typing into?

Here is what my template looks like:

<li ng-repeat="post in feed.posts" class="media media-clearfix-xs">
<form ng-submit="feed.addComment(post.id, post.comment_set)">
  <div class="input-group">
    <input ng-model="feed.desc" type="text" class="form-control" />
        <span class="input-group-btn">
         <button ng-click="submit()" class="btn btn-default"><i class="fa fa-comment-o"></i></button>
        </span>
</div>
</form> 
</li>

2 Answers 2

1

You should have that desc property on post level instead of directly putting inside controller context feed(assuming feed is controller alias)

<input ng-model="post.desc" type="text" class="form-control" />
Sign up to request clarification or add additional context in comments.

Comments

1

It should not , since you have a array where each object which deals with each line, change ng-model to be post.desc not feed.desc

<input ng-model="post.desc" type="text" class="form-control" />

DEMO

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.