【发布时间】:2015-01-07 15:20:52
【问题描述】:
我有一个标题并在重复时对标题进行评论。
我想要做的是,首先隐藏帖子下方的所有输入,然后单击“在下方显示输入”按钮,仅显示该帖子的输入。基本上是一个切换,但在重复中。
$scope.posts = [{"_id":"5","post":"second post","created_at":"2015-01-07T07:11:37.477Z"},{"_id":"542","post":"first post","created_at":"2015-01-07T07:11:30.922Z"}]
<div class="col-sm-12 margin-top-10" data-ng-repeat="post in posts track by $index">
<h4>{{post.post}}</h4>
<button type="button" class="pull-right btn btn-xs">
show input below
</button>
<h6 data-ng-repeat="comment in post.comments track by $index">{{comment}}</h6>
<form name="form.comment">
<input class="col-sm-12" type="text" name="commentText" ng-model="commentText" ng-keyup="$event.keyCode == 13 ? takeComment(post._id, commentText) : null" required>
</form>
<br>
<br>
<br>
</div>
【问题讨论】:
标签: angularjs