AnsweredAssumed Answered

Popup for graphicslayer not displaying

Question asked by dslamb on Apr 24, 2018

I'm using Angular Esri, version 2 (Angular Esri Map), with the JSAPI version 4.5. I'm creating custom graphic layers with a class break renderer. The colors for each class break include a transparency value.

 

The map includes two feature layers with a simple renderer assigned. These are added to the basemap before any graphics layer. The graphicslayer has a popup template assigned. All the layers are polygons (county boundaries, and aggregated county boundaries), and overlap with each other.

 

When I add the graphics layer to the map as the top layer (index 2), then the graphic's popup displays fine. I would like to show the graphics layer at the bottom beneath the feature layer either index 0 or 1. When I add the graphicslayer to the map with these indexes, the popup does not include the template from the graphics layer. It includes popups from the feature layers.

 

I tried forcing the popup by using the hittest from the mapview click event, but this doesn't create any popup.

 

Is this a bug, or are there any better work arounds?

 

This is the code for the hittest that doesn't work:

 

$scope.mapView.on('click',function(e){
   console.log("click event")
   var screenPoint = {
      x:e.x,
      y:e.y
   }

   $scope.mapView.hitTest(screenPoint).then(getGraphics);
      function getGraphics(response){
         console.log("getgraphics")
         console.log($scope.mapView.popup.features)
         console.log(response.results[1].graphic.attributes)


         //response.results[1].graphic.popupTemplate.actions.items[0].visible = true;
           //$scope.mapView.popup.features = [response.results[1].graphic];
         $scope.mapView.popup.open({location:screenPoint,features:[response.results[1].graphic]})

   }
})

Outcomes