AngularJS dynamic ng-option to link two drop downs

后端 未结 1 1742
情歌与酒
情歌与酒 2021-01-03 16:29

Can anyone help me with a ng-option issue, I am trying to have ng-option created dynamically. What I am doing is pretty complex but I tried to explain it in following link

1条回答
  •  一生所求
    2021-01-03 16:58

    Like this?

    Example

    HTML

    JS:

    angular.module("myApp",[])
    .controller("myCtrl",function($scope){
        $scope.County = [{ CountyName: 'C1', countyNumber: '01' }, { CountyName: 'C2', countyNumber: '02' }, { CountyName: 'C3', countyNumber: '03' }, { CountyName: 'C4', countyNumber: '04' }];
        $scope.Municipality = [{ MunicipalityName: 'M1', MunicipalityNumber: '01' }, { MunicipalityName: 'M2', MunicipalityNumber: '02' }, { MunicipalityName: 'M3', MunicipalityNumber: '03' }];
        
        $scope.Districts = [{ DistrictsName: 'D1', DistrictsNumber: '01' }, { DistrictsName: 'D2', DistrictsNumber: '02' }, { DistrictsName: 'D3', DistrictsNumber: '03' }];
        
            $scope.featuretype = [
                { type: 'County', data:$scope.County, displayName:'CountyName' },
                 { type: 'Municipality', data:$scope.Municipality, displayName:'MunicipalityName'},
                 { type: 'District', data:$scope.Districts, displayName:'DistrictsName'}
        ];
    });
    

    0 讨论(0)
提交回复
热议问题