Angular Search Text Box for Materialize
bower install angular-search-text
<link rel="stylesheet" href="angular-search-text.css" />
<script type="javascript" src="angular-search-text.js"></script>
angular.module("yourApp", ["ngSearchText"])
<search-text ng-model="model"
ng-request="request(deferred, text)"
ng-disabled="false"
placeholder="search text..." >
</search-text>
$scope.doSearch = function(deferred, text) {
var result = [];
if (text!=='')
var lowerCaseText = text.toLowerCase();
angular.forEach(searchList, function(s){
if (s.toLowerCase().startsWith(lowerCaseText))
result.push(s);
});
deferred.resolve({data: result});
};
$scope.doSearch = function(deferred, text) {
$http.get("webapi")
.then(function(response){
deferred.resolve({data: response.data});
},
function(response){
deferred.reject(response);
});
};