I am facing an issue with two cascading drop-downs where the JSON data being returned to the second drop-down is not rendering properly due to a promise resolution problem
<div class="row" style="padding-bottom:50px;width:85%;">
<select data-ng-model="search.astate" data-ng-options="s.StateID as s.StateName for s in astates" ng-change="agetLGA()">
<option value="">Filter by state</option>
</select>
</div>
<div class="row" style="width:85%;">
<select data-ng-model="search.algovt" data-ng-options="c.StateLGId as c.LGName for c in algovts" data-ng-disabled="!lgovts">
<option value="">Filter by local govt</option>
</select>
</div>
This is the code that triggers on the change of the first drop-down
$scope.agetLGA = function () {
var stateId = $scope.search.astate;
$scope.algovts = artFact.getLGA().save({stateId:stateId}, function (response){
$scope.algovts = response.data;
});
This is the definition of the getLGA factory
getLGA: function (stateId) {
return $resource('/Home/GetLGA/', { stateId: '@stateId' }, { update: { method: 'POST' } });
}
Encountering the following error:
Error: [$resource:badcfg] object
http://errors.angularjs.org/1.2.13/$resource/badcfg?p0=array
at http://localhost:53536/Scripts/angular.js:78:12
at a.module.factory.f.(anonymous function).p.then.m.$resolved (http://localhost:53536/Scripts/angular-resource.min.js:8:517)
at deferred.promise.then.wrappedCallback (http://localhost:53536/Scripts/angular.js:11033:81)
at deferred.promise.then.wrappedCallback (http://localhost:53536/Scripts/angular.js:11033:81)
at http://localhost:53536/Scripts/angular.js:11119:26
at Scope.$get.Scope.$eval (http://localhost:53536/Scripts/angular.js:12045:28)
at Scope.$get.Scope.$digest (http://localhost:53536/Scripts/angular.js:11871:31)
at Scope.ng.config.$provide.decorator.$delegate.__proto__.$digest (<anonymous>:844:31)
at Scope.$get.Scope.$apply (http://localhost:53536/Scripts/angular.js:12151:24)
at Scope.ng.config.$provide.decorator.$delegate.__proto__.$apply (<anonymous>:855:30)
Seeking assistance to resolve this issue as I have exhausted all possible solutions