Hi I want to combine the singleton data coming with http get with the model from the selection box.
$scope.ShowResult = function() {
$http.get('http://otm.dev/carPrice?modelId=' + $scope.model_id).success(function(data) {
var result = $filter('filter')(data, {
kaskobedel_marka_id: $scope.model_id
})[0];
$scope.name = result.a;
});
};
with
<select class="form-control" name="price" ng-model="year" ng-click="ShowResult()">
<option value="">Select Year</option>
<option value="a">2003</option>
<option value="b">2004</option>
<option value="c">2005</option>
<option value="d">2006</option>
<option value="e">2007</option>
<option value="f">2008</option>
<option value="g">2009</option>
<option value="h">2010</option>
<option value="i">2011</option>
<option value="j">2012</option>
<option value="k">2013</option>
<option value="l">2014</option>
<option value="m">2015</option>
<option value="n">2016</option>
<option value="o">2017</option>
</select>
The database is stored in years a, b, c That is, a = 2003, b = 2004, c = 2005. I need to merge the fetched data with the value from the selection box and get the data for that column. Please help me in my different combinations.
Thanks to everyone, I solved it like this.
$scope.getYear = function (model) {
$http.get('http://otm.dev/carPrice?modelId='+$scope.model_id)
.success(function(resp) {
var result = $filter('filter')(resp, {kaskobedel_marka_id:$scope.model_id})[0];
$scope.name = result[model];
});
};