annu025 February 2016

How can I get cascading dropdown at level 4?

Here is my attempt: If the user hits Territory A i need to display "Sales Team A" and "Sales Team B" as my options.`enter code here: http://plnkr.co/edit/n2A83tHk4r0G1ZWddb7V?p=preview.

<!DOCTYPE html>
<html >
  <head>
    <meta charset="UTF-8">
    <link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css'>
    <link rel="stylesheet" href="css/style.css">
  </head>

  <body>

    <div data-ng-app="myApp"  class="container">
  <form class="form-horizontal" data-ng-controller="dropdownCtrl">

     <div class="form-group">
      <label for="country" class="col-sm-2 control-label">* </label>
      <div class="col-sm-7">             
        <select data-ng-model="customer.Country"
                data-ng-options="obj.id as obj.country for obj in countries"
                data-ng-change="getCountryStates()"
                class="form-control"
                data-ng-required="true"
                id="country">
          <option value="">-- Choose Org --</option>
        </select>      
      </div>
    </div>

    <div class="form-group">
      <label for="state" class="col-sm-2 control-label">** </label>
      <div class="col-sm-7">       
        <select data-ng-model="customer.State"
                data-ng-options="x.Id as x.state for x in sates"
                data-ng-change = "getStateCities()"
                class="form-control"
                data-ng-required="true"
                id="state">
          <option value="">-- Select --</option>
        </select>      
      </div>
    </div>

     <div class="form-group">
      <label for="city" class="col-sm-2 control-label">*** </label>
      <div class="col-sm-        

Answers


Ali Adravi February 2016

You missed two points:

I changed here the parameter to $scope.customer.City

$scope.getStatesSales = function(){
   $scope.sales = CustomerService.getSalesList($scope.customer.City);
}

and in your last drop down you passed the wrong list mySales so I changed it to sales in ng-repeat

data-ng-options="x.Id as x.sales for x in sales"

See the plunker

Post Status

Asked in February 2016
Viewed 3,508 times
Voted 5
Answered 1 times

Search




Leave an answer