I am new to angularjs and not getting this silly thing.please help me with the small problem.
Below is my controller from where i get data to display in dropdowns with filter.
$http.get("http://www.adhr.adnacgroup.com/ADHRM/finalCandidatesJson.php")
.then(function(response)
{$scope.names5 = $scope.names5 = response.data.service;});
$scope.getInfo = function()
{
if ($scope.empInfo1)
{
$scope.company = [$scope.empInfo1["candidate_com","company_id"]];
$scope.location = [$scope.empInfo1['candidate_loc']];
$scope.department = [$scope.empInfo1['candidate_dep']];
$scope.designation = [$scope.empInfo1['candidate_des']];
}
};
and this is my html code to display.
<div class="control-group">
<label class="control-label">Employee Name:</label>
<div class="controls">
<select ng-model="empInfo1" id="employee" class="span2" ng-options="emp.candidate_name for emp in names5 track by emp.candidate_id" ng-change="getInfo()">
<option value="">-- Select Employee --</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Company Name:</label>
<div class="controls">
<select ng-model="empInfo2" id=company ng-disabled="!empInfo1" class="span2" ng-options="cancom for cancom in company">
<option value="">-- Select Company --</option>
</select>
</div>
</div>
To display i want candidate_com and to store in db i want company_id from below code but this code gives me only company_id to display.
$scope.company = [$scope.empInfo1["candidate_com","company_id"]];
How to set ng-options to display candidate_com from this and to store company_id in below ng-options:
<div class="controls">
<select ng-model="empInfo2" id=company ng-disabled="!empInfo1" class="span2" ng-options="cancom for cancom in company">
<option value="">-- Select Company --</option>
</select>
</div>