Angular.js多个TextArea

时间:2017-07-09 20:54:15

标签: javascript html angularjs

在我的代码中重复

<div class="feed-element"ng-repeat="message in messages">
                                <a href="" class="pull-left">
                                    <img alt="image" class="img-circle" src="{{message.src}}"onerror="this.src='https://cdn2.iconfinder.com/data/icons/transparent-round-icons/512/user.png';">
                                </a>

                                <div class="media-body ">
                                    <small class="pull-right"></small>
                                    <strong> {{message.User}} <br>
                                    <small class="text-muted">{{message.Date}}</small>
                                    <div class="well">
                                       {{message.Question}}
                                    </div>
                                    <div class="pull-right">
                                        <div class="well"style="display:{{message.isAnswered}}">{{message.Answer}}</div>
                                        <div class="social-comment"style="display:{{message.isAnswered2}}">

                                            <div class="media-body">
                                                <textarea class="form-control" placeholder="Cevap Yazın..."></textarea>
                                            </div>
                                        </div><br>

                                        <a class="btn btn-xs btn-primary"style="display:{{message.isAnswered2}};width:150px;"  ng-click="answer(message.Id)"><i class="fa fa-pencil"></i> Mesaj Gönder</a>

                                    </div>
                                </div>
                            </div>

在这段代码中,每条消息都有textarea和一个按钮,每条消息对任何用户都是唯一的,所以当我点击一个按钮时,我只想获得该文本的文本textarea,但我不能这样做我该怎么办?它?

由于

1 个答案:

答案 0 :(得分:0)

替换您的textarea如下, yourtextareavalue应该是绑定值的关键名称

<textarea class="form-control" ng-model="message.yourTextAreaValue" 
placeholder="Cevap Yazın..."></textarea>