javascript - Cannot call angularjs function from dropdown(select) using select2 -


i hitting database on dropdown's on-change event. have make tags after userselects of them.

jsp file

<select id="multipleselectlocation" data-placeholder="select option" ng-model="search" ng-change="searchlocation(search)" multiple="true" >                      <option value="1">option 1</option>                     <option value="2" ng-repeat="location in userlocationlist"> {{ location.city }},&nbsp; {{location.state}}, &nbsp;<b>{{location.country}}</option>                          </select> 

controller

$scope.searchlocation = function(search)     {         /*         if (search.length < 3) {             $scope.userlocationlist = null;             return false;         }*/            $http.get(                 location.protocol + '//' + location.host                         + contextpath + '/services/searchlocation', {                     params : {                         "search" : search                      }                 }).then(function(response) {              $scope.userlocationlist = response.data;                 if ($scope.userlocationlist.length == 0) {                 console.log('no location')             }         }, function(error) {              console.log("error while searching");             console.log(error);         });      }   $(document).ready(function() { $("#multipleselectlocation").select2(); });  

if have input text , call searchlocation controller works fine. cannot call dropdown.

<select id="multipleselectlocation" data-placeholder="select option" ng-model="search" ng-change="searchlocation()" multiple="true" > 

controlloer

$scope.searchlocation = function() {    $scope.selected = $scope.search  } 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -