I am able to populate 2 dropdowns directly from database. My problem is, the 2nd dropdown values has to be populated based on the 1st dropdown selection. Since i am new to
Do it like this:
With javascript you just need only one controller, the office controller:
angular.module('myApp',[])
.controller('OfficeCtrl',
['$scope','$location','OfficeNames','OfficeObjCode',function($scope,
$location, OfficeNames,OfficeObjCode)
{
$scope.Offices=OfficeNames.query();
$scope.updateObjects =function(office_id)
{`// take {{office_id}} to server to pick codes based
//on that office id and
// then assign them to $scope.codes..`
$scope.Codes = 'what you came back with';
}
}).factory('OfficeNames', function ($resource) {
return $resource(
'api/Office/:id',
{ id: '@id' },
{ update: { method: 'PUT' } }
);
}).factory('OfficeObjCode', function ($resource) {
return $resource(
'api/OfficeObj/:id',
{ id: '@id' },
{ update: { method: 'PUT' } }
);
});