JSON-, Angular .
:
<input ng-model="criteria"/>
<ul>
<li ng-repeat="entry in entries | filter:{title: criteria}" id="{{entry.id}}">
<h2>{{entry.title}}</h2>
<p>{{entry.body}}</p>
</li>
</ul>
( JS ):
app.controller('MainCtrl', function($scope) {
$scope.criteria = "Title";
$scope.entries = [
{
id: 1,
title: 'My title',
body: 'contents...'
},
{
id: 2,
title: 'The other content',
body: 'contents...'
},
{
id: 3,
title: 'Another title',
body: 'contents...'
},
{
id: 4,
title: 'Something completely different',
body: 'contents...'
}
];
});
$http JSON:
app.controller('MainCtrl', function($scope) {
$scope.criteria = "Title";
$scope.entries = $http.get('path/to/entries.json');
});