angularjs - Angular.js autocomplete with $http.get TypeError: Cannot read property 'success' of undefined -


with code typeerror: cannot read property 'success' of undefined. i've tried .then instead of .success same error. after plus ten hours of googling i'm little bit desperate...

html:

<div ng-controller="search_interest" layout="column">     <md-chips ng-model="ctrl.selectedvegetables" 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 vegetable">             <span md-highlight-text="searchtext">{{item.name}} :: {{item.type}}</span>         </md-autocomplete>         <md-chip-template>             <span>             <strong>{{$chip.name}}</strong>             <em>({{$chip.type}})</em>             </span>         </md-chip-template>     </md-chips> </div> 

and js:

var app = angular.module('autocomplete_app', ['ngmaterial']);  app.controller('search_interest',     function($scope, $http){         $scope.searchtext = '';         $scope.selecteditem = undefined;         function getinterest($scope){             $http.get("someurl.php?query=" + $scope.searchtext)                 .success(function(data){                     $scope.interest = data;                     console.log('data', json.stringify(data));                 });         };     }); 

the problem wasn't http call calls angular materials import done, can see in bellow image problem on angularjs-materials.js on line 10.

console image

enter image description here

you can @ version: i've add plunker in comment above.

i've changed bit header of html page. not working because can't call url requested on solution should work.


Comments

Popular posts from this blog

javascript - How to process users in one specific order using map o each function? -

java - Two interface have same method name with different return type -

javascript - Linking from page A to a specific iframe on page B -