JSFiddle - React, Tailwind, and code Playground

by Emanuel Vecchio

HTML

<div ng-app="myapp" ng-controller="ctrl as vm">
<input ng-model="search" type="text"/>
<p data-ng-repeat="item in vm.filtered = (vm.data | filter:search)">
{{item}}
</p>
Items: {{vm.filtered.length}}
<button ng-click="vm.onbutton()">Show me</button>
</div>

JavaScript

var mod = angular.module('myapp', []);

mod.controller('ctrl', function() {
	var vm = this;
    vm.data = ['alice', 'bob', 'carol', 'david', 'ema'];
    
    vm.onbutton = function() {
        // access here the filtered data.
        console.log(vm.filtered);
        alert(vm.filtered);
    }
});