If you want to showcase all elements of an object and choose a specific one using ng-if, consider listing the keys and values separately using the syntax
ng-repeat="(key,value) in your_array"
. Here is a brief example:
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.responses = {
customer: {
results: 2938,
id: 9283
},
bredesh: {
results: 2938,
id: 248
}
}
$scope.id = 248;
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<div ng-repeat="(key, value) in responses">
<div ng-if="responses[key].id==id" class="form-group">
{{key}} - {{value}}
</div>
</div>
<button ng-click="id=248">Select ID: 248</button>
<button ng-click="id=9283">Select ID: 9283</button>
</div>
Alternatively, if manual selection is needed, use responses.customer.id
and responses.bredesh.id
.