I just started up learning AngularJS and I have no idea how to solve this problem. For example I have 4 records (car, plane, ship, train) and I only want to show 2 randomly in ng-repeat.
Examples: 1.st. plane, ship 2.nd. car, train 3.rd. train, plane
So how would syntax look like ?
JS:
app.controller('WorkCtrl', function($scope, $http) {
$http.get('work.json').success(function(work) {
$scope.work = work;
});
});
HTML:
<div class="work" ng-controller="WorkCtrl">
<ul class="grid">
<li ng-repeat="work in work">
<a href="@{{ work.link }}" target="blank_">
<div class="background"></div>
<h3 class="name">@{{ work.name }}</h3>
<p class="description">@{{ work.description }}</p>
<img ng-src="@{{ work.image_path }}">
</a>
</li>
</ul>
</div>