Angular Material AutoComplete


#1

I’m so new here
I’m stragling to make autocomlete from mongoDb collection and angular matterial but realy cannot make it happen
I make collection and controller but never success full .
I try so many frame work for 1 year but not successful at all
my controller:
$scope.subscribe(‘country’, function() {
return [{
sort: $scope.getReactively(‘sort’),
limit: parseInt($scope.getReactively(‘perPage’)),
skip: ((parseInt($scope.getReactively(‘page’))) - 1) * (parseInt($scope.getReactively(‘perPage’)))
}, $scope.getReactively(‘search’)];
});
function querySearch (query) {
var results = query ? country.filter( createFilterFor(query)): [];
return results;
}
function createFilterFor(query) {
var lowercaseQuery = angular.lowercase(query);
return function filterFn(country) {
return (country.value.indexOf(lowercaseQuery) === 0);
};
}

        });

and my collection country have data in side
{
"_id" : ObjectId(“59378477c64086fff293008b”),
" Country Code(3 letter)" : “AFG”,
" Country Name" : “Afghanistan”,
“Country Code(2 letter)” : “AF”
},

my view:
html
< md-autocomplete flex required
md-input-name="autocompleteField"
md-input-minlength="2"
md-input-maxlength="18"
md-no-cache="ctrl.noCache"
md-selected-item="ctrl.selectedItem"
md-search-text="ctrl.searchText"
md-items="item in ctrl.querySearch(ctrl.searchText)"
md-item-text="item.Country_Name"
md-floating-label=“Favorite state”>
< md-item-template>
< span md-highlight-text=“ctrl.searchText”>{{item.Country_Name}}
< /md-item-template>
< div ng-messages=“searchForm.autocompleteField.$error” ng-if=“searchForm.autocompleteField.$touched”>
< div ng-message=“required”>You must have a favorite state.
< div ng-message=“minlength”>Your entry is not long enough.
< div ng-message=“maxlength”>Your entry is too long.
< /div>
< /md-autocomplete>

but not working at all
any help will be save my life