Using angular 1.6.4 I'm unable to use a filter on an ng-repeat across an adjacent component. In the example I've created a component for the dynamic listing of data (ng-repeat) and then a separate component for the search input. I can't figure out how to pass the data from the search component to the keyfeed component.
app.js
app.component('keyfeed', {
bindings: {
search: '='
},
template: `
<ul>
<li ng-repeat="record in records | filter:search">{{ record }}</li>
</ul>
`,
controller: function($scope) {
$scope.records = [
"Alfreds Futterkiste",
"Berglunds snabbköp",
"Centro comercial Moctezuma",
"Ernst Handel",
];
}
});
app.component('search', {
bindings: {
search: '='
},
template: `
<input type="search" search="$ctrl.search" ng-model="search">
`,
controller: function() {
}
});
index.html
<search search="search"></search>
<keyfeed search="search"></keyfeed>
Plunker: view