I ve been trying to populate a searchable drop down list using json data with angularjs , i ve pushed the json data in the server and i ve been able to receive the response from the server if i use the get method.I dont know exactly how to query the json data and populate them in the search bar. I ve attached the controller script and the html
var app=angular.module('myapp',[]);
app.controller('myctrl',function($scope,$http){
$http({
method:"GET",
url:"http://localhost:5050/codes?val="}).then(function mySuccess(response){
$scope.msg=response.data;
},function myError(response){
$scope.msg=response.statusText;
});
});
<!DOCTYPE html>
signals
<body>
<div ng-app="myapp" ng-controller="myctrl" >
<select ng-model="search">
<option ng-repeat="names in msg " value="{{names.value}}"></option>
</select>
</div>
</body>
This is the sample json data that i am feeding to the page from the local host i have to populate the search bar with the "value" part of the json data.
{"codes":
[{"code": "NSE/AHLWEST", "value": "Asian Hotels (West) Limited"},
{"code": "NSE/JINDALSWHL", "value": "Jindal South West Holding Limited"},
{"code": "NSE/WIPL", "value": "The Western India Plywoods Limited"},
{"code": "NSE/WSTCSTPAPR", "value": "West Coast Paper Mills Limited"}]
}
msg.codesin yourng-repeattag