AngularJS export filtered JSON data.
HTML
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<div ng-app="myApp" ng-controller="MainCtrl">
<div class="panel panel-default">
<input type="text" ng-model="search.title">
<ul ng-repeat="b in data">
<h4>{{b.header}}</h4>
<ul>
<li ng-repeat="item in (b.items | filter:search.title)">{{item.title}}</li>
<!-- something like this-->
<li ng-repeat="item in datas[$parent.$index] = (b.items | filter:search.title)">{{item.title}}</li>
</ul>
</ul>
</div>
</div>
CSS
body {
padding: 20px 40px;
}
JavaScript
var app = angular.module('myApp', []);
app.controller('MainCtrl', ['$scope', '$filter', function ($scope) {
var d = [{
header: "title1",
items: [{
title: "Bad"
}, {
title: "Good"
}, {
title: "Great"
}, {
title: "Cool"
}, {
title: "Excellent"
}, {
title: "Awesome"
}, {
title: "Horrible"
}, ]
}, {
header: "title2",
items: [{
title: "Bad1"
}, {
title: "Good1"
}, {
title: "Great1"
}, {
title: "Cool1"
}, {
title: "Excellent1"
}, {
title: "Awesome1"
}, {
title: "Horrible1"
}]
}];
$scope.data = d;
$scope.datas = [];
}]);