1
の値をng-attr-id
で取得する方法はありますか?角度:ng-attr-idでng-modelを取得しますか?
私はコメント/返信ボックスを作成しています。私は現在の返信の価値を得たいと思います。ここで
は、ここに私のhtml--
<div class="comments-list" ng-show="CommentsLoaded">
<ul>
<li ng-repeat="comment in comments">
<div>
{{comment.content}}
</div>
<div ng-click="showReply(comment.id)">
Reply
</div>
<div ng-class="hideReply" ng-attr-id="{{'reply-'+comment.id}}">
<textarea ng-model="replytxt" ng-attr-id="{{'replytxt-'comment.id}}"></textarea>
<div class="form-group">
<button type="button" ng-click="sendReply(comment.id)">
Publier
</button>
</div>
</div>
</li>
</ul>
</div>
あり、これはコンソールで上記の機能のショーangularjs--
$scope.sendReply = function(commentId){
var elm = document.getElementById('replytxt-'+commentId);
console.log(elm);
}
です:あなたは必要ありません
<textarea ng-model="replytxt" ng-attr-id="{{'replytxt-'+comment.id}}" class="ng-pristine ng-valid ng-touched" id="replytxt-31"></textarea>
は素晴らしい作品。あなたの提案は私のものよりも優れています。ありがとうございました –
@AmadouBeyeそれを知ってうれしい、ありがと;) –