ArcGIS-JS-API-自定义弹出窗口模板不显示内容(Angular11)
创始人
2024-09-12 04:30:54
0

如果您使用 Angular 11 来开发您的 ArcGIS-JS-API 应用程序,并且发现您的自定义弹出窗口模板无法显示内容,则可以遵循下面的步骤来解决这个问题。

  1. 在您的组件类中定义弹出窗口模板:
import { loadModules } from 'esri-loader';

@Component({
  ...
})
export class MapComponent implements OnInit {
  popupTemplate: any;

  constructor() {
    this.popupTemplate = {
      title: '{Name}',
      outFields: ['*'],
      content: [{
        type: 'fields',
        fieldInfos: [{
          fieldName: 'Type',
          label: 'Type'
        }]
      }]
    };
  }

  ngOnInit() {
    loadModules([
      'esri/Map',
      'esri/views/MapView',
      'esri/layers/FeatureLayer'
    ]).then(([Map, MapView, FeatureLayer]) => {
      const map = new Map({
        basemap: 'streets-navigation-vector'
      });

      const view = new MapView({
        container: 'mapView',
        map: map,
        center: [-118.244, 34.052],
        zoom: 13
      });

      const featureLayer = new FeatureLayer({
        url: 'http://sampleserver6.arcgisonline.com/arcgis/rest/services/Earthquakes_Since1970/MapServer/0',
        outFields: ['*'],
        popupTemplate: this.popupTemplate
      });

      map.add(featureLayer);
    });
  }
}

在这个例子中,我们定义了一个弹出窗口模板,并将其分配给 FeatureLayer 的 popupTemplate 属性。

  1. 将 Popup 组件添加到您的 HTML 模板中:

在这个例子中,我们使用 Angular ESRI 组件来添加 Popup 组件。如果你没有使用 Angular ESRI,则需要手动添加 Popup 组件。

  1. 将 Popup 组件的 arc

相关内容

热门资讯

透视辅助!wepoker透视脚... 【福星临门,好运相随】;透视辅助!wepoker透视脚本网页,智星德州插件2024最新版,透视教程(...
透视肯定!德普之星辅助器app... 透视肯定!德普之星辅助器app,hhpoker是内部控制吗,可靠技巧(确实存在有挂);科技安装教程;...
透视代打!aapoker辅助器... 透视代打!aapoker辅助器怎么用,pokemomo辅助工具,力荐教程(本然存在有挂);玩家必备必...
透视真的!aapoker透视脚... 1、透视真的!aapoker透视脚本安装包,大菠萝免费辅助,德州论坛(一直有挂)。2、aapoker...
透视ai代打!wepoker辅... 透视ai代打!wepoker辅助工具,wepoker怎么发冤家牌,2025新版技巧(固有真的是有挂)...
透视规律!hhpoker开辅助... 透视规律!hhpoker开辅助软件,wepoker祈福有用吗,大神讲解(固有是真的有挂)是一款可以让...
透视透视!wepoker透视,... 透视透视!wepoker透视,wepoker有透视吗,攻略教程(原生是真的有挂);玩家在wepoke...
透视线上!wpk透视辅助靠谱吗... 透视线上!wpk透视辅助靠谱吗,德州透视脚本,扑克教程(好像是有挂);免费wpk透视辅助靠谱吗平台A...
透视科技!aapoker辅助功... 透视科技!aapoker辅助功能,wepoker黑侠破解,wepoke教程(竟然真的有挂)1、许多玩...
透视计算!德普之星透视辅助软件... 透视计算!德普之星透视辅助软件是真的吗,wepoker正确养号方法,细节方法(切实存在有挂)需要回顾...