私はangularjs httpリクエストを開始しました。次のようにデータを取得できました。しかし、最初の項目を "collapse in"の代わりに "collapse in"解決策を見つける。anglejsリストに最初の項目のクラスを追加するには
Angularjs
var app = angular.module('myApp', []);
app.controller('myCtrl2', function ($scope, $http) {
$http.get('../C_Angular.asmx/ShowArticle')
.then(function (response) {
$scope.Articles = response.data;
});
});
<div class="panel-group" data-ng-repeat="Art in Articles" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" data-ng-href="{{Atr.Art_ID}}">
{{Art.Art_Title}}
</a>
</h4>
</div>
<div data-ng-id="{{Atr.Art_ID}}" class="panel-collapse collapse"> <%-- my prolblem here is
how to put a class "panel-collapse collapse in" to the first item in the list
instead of "panel-collapse collapse" --%>
<img data-ng-src="{{Art.Art_Pic}}" style="margin: 20px; border: 4px solid #FFFFFF;
width: 140px; height: 100px; float: left;" />
<div class="panel-body" style="padding: 5px; margin: 5px; text-align: right; background-image: url('../App_Pic/bg03.jpg');">
{{Art.Art_Body}}
</div>
<button type="button" class="btn btn-primary btn-sm " style="margin-bottom: 10px">Read More ...</button>
</div>
</div>
</div>
HTMLは、あなたは私がangularjsリストの最初の項目にクラス "に" を追加する方法を見つけるために助けてくださいますか?
ありがとうございました。それはとても役に立つ@Alon Eitanです。しかし、さらに、私は、パネルを1つだけパネルを使い、他のパネルはすべて折りたたむことができるようにする必要があります。どうすればいいですか? –
@MohamedSheshtawy喜んで助けてください。 **アコーディオン**実装をご覧ください - http://angular-ui.github.io/bootstrap/#!#accordion –