2017-06-14 21 views
0

私はこのdivの中にbootstrapクラスcol 12を持つdivを持っています。私はbootstrapクラスcol 4を持つ3つのdivを持っています。 今私のデータベースから料理のリストを取得しています。3つの異なるdivでng-repeat

私はNGリピートを使用して(繰り返しなし)3つの別のdiv要素で料理を表示したい:

cuisine1    cuisine3   cuisine5 
cuisine2    cuisine4   cuisine5 
:私はのようにそれらを表示したい私のページで

cuisine1 
cuisine2 
cuisine3 
cuisine4 etc.. 

: データ応答

助けてください? 1 ng-repeatを使ってどうすればいいのですか

+0

これは私が欲しいものである –

答えて

1

これは役に立ちます。あなたの場合は、要件に基づいて詳細を表示します。

var app = angular.module("myApp", []); 
 
app.controller("myCtrl", function($scope) { 
 
    $scope.records = [ 
 
     "cuisine1", 
 
     "cuisine2", 
 
     "cuisine3", 
 
     "cuisine4", 
 
     "cuisine5" 
 
    ] 
 
});
.col-xs-4{ 
 
    border:1px solid black; 
 
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> 
 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 
 
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> 
 
<body ng-app="myApp" ng-controller="myCtrl"> 
 
<div class="row"> 
 
<div class="col-xs-4" ng-repeat="x in records"><h1>{{x}}</h1></div> 
 
</div>

それが役に立てば幸い:)

+0

\あなたのJSON配列を投稿してください。ありがとう)) –

+1

あなたは歓迎:)。お力になれて、嬉しいです。あなたの問題を解決するなら、これを答えにしてください。 – Manish

+0

完了し、30秒待っていました:) –

関連する問題