0

How would I use a Select Option in AngularJS to select item in multiple item array. This is for a google map API application. If I select Manager1, I want to return the markers resolved to Bert Bingham etc. The examples I found is to list the items in an array[], but it doesn't return anything this way. Thanks!

JSON

var sites= [
    {name: "ABC",ISE:["Bert Bingham","Manager1"],lat:"29.9792183",lng:"-90.22268919999999"},
    {name: "Ajax",ISE:["Bert Bingham","Manager1"],lat:"30.0032515",lng:"-90.22060119999999"},
    {name: "CBS",ISE:["Bing Bingle","Manager2"],lat:"31.9703011",lng:"-90.08290799999999"},
    {name: "Turner",ISE:["Bing Bingle","Manager2"],lat:"31.004759",lng:"-90.17053299999999"},   
];

HTML

<div ng-app="mapsApp" ng-controller="MapCtrl">

    <div align ="center" class ="input-w">
        <div class ="gulf">Gulf States</div>

        <fieldset>

          <label>ISE: </label> 
          <select id ="ISEs" class="dropdown" name="singleSelect"
                  ng-model="data.singleSelect"
                  ng-change="filterMarkers();centerMap()">
             <option value="0">all</option>
             <option id ="1"  value="Bert Bingham">Bert Bingham</option>
             <option id = "2" value="Bing Bingle">Bing Bingle</option>
             <option id = "2" value="Manager1">Manager1</option>
             <option id = "2" value="Manager2">Manager2</option>

          </select><br><br>
       </fieldset>
    </div> 
    <div id="map"></div>
2
  • you can add multiple attribute on select to select multiple options so in that way all selected values will show up in your model "data.singleSelect" as array. Commented Jul 3, 2019 at 5:30
  • I guess it seems same like this stackoverflow.com/questions/35173373/… Commented Jul 3, 2019 at 6:29

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.