title: Add popup for every source and layer in Mapbox GL JS
body: <p>I have several sources and layers generated on my map through looping as can be seen on the source code.</p>
  
  <pre><code>var id, lat, lng, point;
  
  function setPosition() {
      $.post('m/getData.php', function(data) {
          var split = data.split(",");
          for (i = 0; i &lt; split.length - 1; i++) {
              var secSplit = split[i].split("|");
              id = secSplit[0];
              lat = secSplit[1];
              lng = secSplit[2];
              point = {
                  "type": "Point",
                  "coordinates": [lng, lat]
              };
              map.addSource(id, {
                  type: 'geojson',
                  data: point
              });
              map.addLayer({
                  "id": id,
                  "type": "symbol",
                  "source": id,
                  "layout": {
                      "icon-image": "ferry-15"
                  }
              });
          }
      });
  }
  </code></pre>
  
  <p>For my question, is it possible to dynamically bind popup to every sources and layers using Mapbox GL JS?</p>
  
  <p>From what I have seen on Mapbox example, it shows only how to bind popup with feature collection from a single layer as you can see <a href="https://www.mapbox.com/mapbox-gl-js/example/popup-on-click/" rel="nofollow noreferrer">here</a></p>