JSFiddle - React, Tailwind, and code Playground
by partyk1d24
HTML
<div ng-app="myApp" ng-controller="MainCtrl">
<input type="text" ng-model="inFilter" ng-change="setOption()"></input>
<select ng-if="options.length > 0" ng-model="selectedOpt" ng-options="opt for opt in options"></select>
<div ng-if="options.length <= 0"> There were no options found</div>
<p>Selected = {{selectedOpt === inFilter}}</p>
<div ng-repeat="value in options">
{{value}} {{$index}}
</div>
</div>
JavaScript
angular.module('myApp', []);
function MainCtrl($scope, $filter) {
var options = ['as', 'b', 'c', 'a2'];
$scope.opt1 = 0;
console.log($filter == null);
$scope.options = options;
$scope.selectedOpt = $scope.options[0];
$scope.setOption = function() {
$scope.options = $filter('filter')(options, $scope.inFilter);
if($scope.options.indexOf($scope.inFilter) > -1){
$scope.selectedOpt = $scope.inFilter
};
}
}