When i call $scope.getInterest i get my json back: i can see i console some
like this:
data [{"name":"Backgammon","type":8},{"name":"Monopoli","type":5}]
But no dropdown menu opens and no items appears in my autocomplete input.
I don't get any error...only i can't see dropdown and items...so there's no
autocomplete. Is there any mistakes in my code? Thanks
HTML:
<body layout="column">
<div ng-controller="search_interest" layout="column">
<md-content class="md-padding" layout="column">
<md-chips ng-model="search_interest_a" md-autocomplete-snap
md-require-match>
<md-autocomplete
md-selected-item="selectedItem"
md-search-text="searchText"
md-items="item in getInterest(searchText)"
md-item-text="item.name"
placeholder="Search for a vegetable">
<span md-highlight-text="searchText">{{item.name}} ::
{{item.type}}</span>
</md-autocomplete>
<md-chip-template>
<span>
<strong>{{$chip.name}}</strong>
</span>
</md-chip-template>
</md-chips>
</md-content>
</div>
</body>
JS:
var app = angular.module('autocomplete_app', ['ngMaterial']);
app.controller('search_interest',
function($scope, $http) {
$scope.searchText = '';
$scope.selectedItem = undefined;
$scope.getInterest = function() {
$http.get("../inc/users/search_interest.php?query=" +
$scope.searchText)
.success(function(data) {
console.log('data', JSON.stringify(data));
return data.data;
});
};
});
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.