1

All I bind the data using AngularJS ng-repeat and now I try to implement cascading in AngularJS using editable-select but it's won't work anyone help how to solve this problem.

My requirement is I need two drownlists one is for Country, second one is for States.

When I select Country dropdown, need to load only those country related states.

How can I do it by using all the above techniques?

Here,I attached jsfiddle link.

Saugat Bhattarai
  • 2,614
  • 4
  • 24
  • 33
jose
  • 1,044
  • 1
  • 12
  • 35

1 Answers1

0
    function CountryCntrl($scope) {
                    $scope.countries = {
                        'India': {
                            'Maharashtra': ['Pune', 'Mumbai', 'Nagpur', 'Akola'],
                            'Madhya Pradesh': ['Indore', 'Bhopal', 'Jabalpur'],
                            'Rajasthan': ['Jaipur', 'Ajmer', 'Jodhpur']
                        },
                        'USA': {
                            'Alabama': ['Montgomery', 'Birmingham'],
                            'California': ['Sacramento', 'Fremont'],
                            'Illinois': ['Springfield', 'Chicago']
                        },
                        'Australia': {
                            'New South Wales': ['Sydney'],
                            'Victoria': ['Melbourne']
                        }
                    };
                }

<div ng-controller="CountryCntrl">
            <div>
                Country: 
                <select id="country" ng-model="states" ng-options="country for (country, states) in countries">
                    <option value=''>Select</option>
                </select>
            </div>
            <div>
                States: <select id="state" ng-disabled="!states" ng-model="cities" ng-options="state for (state,city) in states"><option value=''>Select</option></select>
            </div>
            <div>
                City: <select id="city" ng-disabled="!cities || !states" ng-model="city"><option value=''>Select</option> <option ng-repeat="city in cities" value='{{city}}'>{{city}}</option></select>        
            </div>
        </div>

Take it from: http://devzone.co.in/simple-example-of-dependable-dropdowns-cascading-dropdowns-using-angularjs/

Carnaru Valentin
  • 1,690
  • 17
  • 27