<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Expand widget content property works differently in ESM vs AMD in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/expand-widget-content-property-works-differently/m-p/1411761#M84371</link>
    <description>&lt;P&gt;This might be an issue with the Angular syntax that you are using. Here's an example codepen using the ArcGIS ESM CDN (for prototyping-only) that shows getElementById() working: &lt;A href="https://codepen.io/andygup/pen/poBxxxw?editors=1000" target="_blank"&gt;https://codepen.io/andygup/pen/poBxxxw?editors=1000&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;With Angular try using "@viewChild": &lt;A href="https://angular.io/api/core/ViewChild" target="_blank"&gt;https://angular.io/api/core/ViewChild&lt;/A&gt;. And, here's an example usage of viewChild with "@arcgis/core":&amp;nbsp; &lt;A href="https://github.com/Esri/jsapi-resources/blob/main/esm-samples/jsapi-angular-cli/src/app/app.component.ts#L28" target="_blank"&gt;https://github.com/Esri/jsapi-resources/blob/main/esm-samples/jsapi-angular-cli/src/app/app.component.ts#L28&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; @ViewChild('mapViewNode', { static: true }) private mapViewEl!: ElementRef;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Apr 2024 16:38:09 GMT</pubDate>
    <dc:creator>AndyGup</dc:creator>
    <dc:date>2024-04-18T16:38:09Z</dc:date>
    <item>
      <title>Expand widget content property works differently in ESM vs AMD</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/expand-widget-content-property-works-differently/m-p/1410659#M84358</link>
      <description>&lt;P&gt;Migrated from local AMD modules to ES modules via npm. Migration went smoothly with the exception of the Expand widget's content property no longer allows document.getElementById(). Using Angular for reference.&lt;/P&gt;&lt;P&gt;When using AMD for the ability to edit map notes layer, I had the following for html&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      &amp;lt;div id="sketchBar" class="sketch-bar"&amp;gt;
        &amp;lt;div class="sketch-buttons"&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-map-pin" id="pointButton" type="button" title="Draw point"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-polyline" id="polylineButton" type="button" title="Draw polyline"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-polygon" id="polygonButton" type="button" title="Draw polygon"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-comment" id="textButton" type="button" title="Draw text"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-trash" id="resetButton" type="button" title="Clear all graphics"&amp;gt;&amp;lt;/div&amp;gt;
          &amp;lt;div class="esri-widget--button esri-widget esri-interactive action-button esri-icon-trash hidden" id="destroyGraphicButton" type="button" title="Destroy selected graphic"&amp;gt;&amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;then would initialize an expand widget with&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const sketchExpand = new Expand({
      expandIcon: 'pencil-tip',
      view: this.mapView,
      content: document.getElementById('sketchBar'),
      expandTooltip: 'Sketch',
      group: 'top-right'
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now with the ES modules I keep getting an error stating content must be undefined | string | Node.&lt;/P&gt;&lt;P&gt;So I switched document.getElementById('sketchBar') to&amp;nbsp;document.getElementById('sketchBar').innerHTML which works, but now i have buttons in the expand content that don't work and the html showing up where with the AMD the entire html content would be essentially moved into the expand widget content.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure how to proceed. An ES module sample of the &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/layers-mapnoteslayer/" target="_self"&gt;map notes layer example&lt;/A&gt; would be helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 21:49:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/expand-widget-content-property-works-differently/m-p/1410659#M84358</guid>
      <dc:creator>YuriWorkTech</dc:creator>
      <dc:date>2024-04-16T21:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: Expand widget content property works differently in ESM vs AMD</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/expand-widget-content-property-works-differently/m-p/1411761#M84371</link>
      <description>&lt;P&gt;This might be an issue with the Angular syntax that you are using. Here's an example codepen using the ArcGIS ESM CDN (for prototyping-only) that shows getElementById() working: &lt;A href="https://codepen.io/andygup/pen/poBxxxw?editors=1000" target="_blank"&gt;https://codepen.io/andygup/pen/poBxxxw?editors=1000&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;With Angular try using "@viewChild": &lt;A href="https://angular.io/api/core/ViewChild" target="_blank"&gt;https://angular.io/api/core/ViewChild&lt;/A&gt;. And, here's an example usage of viewChild with "@arcgis/core":&amp;nbsp; &lt;A href="https://github.com/Esri/jsapi-resources/blob/main/esm-samples/jsapi-angular-cli/src/app/app.component.ts#L28" target="_blank"&gt;https://github.com/Esri/jsapi-resources/blob/main/esm-samples/jsapi-angular-cli/src/app/app.component.ts#L28&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; @ViewChild('mapViewNode', { static: true }) private mapViewEl!: ElementRef;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Apr 2024 16:38:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/expand-widget-content-property-works-differently/m-p/1411761#M84371</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2024-04-18T16:38:09Z</dc:date>
    </item>
  </channel>
</rss>

