<?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: Directions widget persistance in Angular Component in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1152190#M76610</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/567887"&gt;@lawsonkendall&lt;/a&gt; can you provide a github repo example? I'm not 100% certain I understand the architecture. On the surface the implementation sounds like its unsupported because its intermixing Angular component life-cycle with the ArcGIS widget life-cycle.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; If I can't connect an existing Directions widget (containing already-retrieved route info) to a new view div&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This isn't possible. All of the APIs out-of-the-box widgets have private undocumented dependencies on the MapView (or SceneView), so a widget can't be disconnected from a View and then reattached.&lt;/P&gt;&lt;P&gt;I'm tagging &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt; for any input he may have related to caching route info and programmatic access.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2022 16:11:24 GMT</pubDate>
    <dc:creator>AndyGup</dc:creator>
    <dc:date>2022-03-09T16:11:24Z</dc:date>
    <item>
      <title>Directions widget persistance in Angular Component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1151900#M76603</link>
      <description>&lt;P&gt;I have a Directions widget (&lt;SPAN&gt;@arcgis/core/widgets/Directions) within an Angular Component.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The component gets deleted whenever a user navigates away from the component (as is typical for Angular components).&amp;nbsp; If a user enters addresses on the Directions form, resulting in successful calculation of a route + rendering of the route line on the map; closes the component, then later re-opens the component, I would like for their previously entered data to (still) be on the Directions form.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I remove the call to&amp;nbsp;this.directionsWidget.destroy() inside&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;ngOnDetroy()&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;the route line remains on the map when the component is closed.&amp;nbsp; So far, this is good and the desired behavior.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When I reselect the component containing the Directions widget, causing a new component to be created, it has no memory of the previously entered stops.&amp;nbsp; I can use a service to save the Directions widget, but any attempts to re-connect the old Directions widget with the new component div simply results in a blank space where the Directions form is normally displayed.&amp;nbsp; Likewise, I can retrieve/restore "lastRoute", or individual stops from the "old" widget.&amp;nbsp; But it doesn't appear as if there's any means to add an already existing Route, or set of stops, to a newly constructed Directions widget programmatically.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I can't connect an existing Directions widget (containing already-retrieved route info) to a new view div (preferred solution), is it at least possible to:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;construct a new Directions widget using previously cached Route info? or&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;add stops, or Route data to a Directions widget programmatically (e.g. from within Angular's ngAfterViewInit())?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;From looking at the &lt;A title="Directions API doc link" href="https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Directions.html" target="_blank" rel="noopener"&gt;Directions API documentation&lt;/A&gt; it doesn't seem as if any of these things is possible, but I'm hoping someone can point out something I've overlooked.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Software Versions:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;ArgGIS: 4.22.2&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;Angular: 13.1.3 (TypeScript 4.5.4)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(For what it's worth, my first attempt to solve this problem was to implement Angular's RouteReuseStrategy interface.&amp;nbsp; This doesn't work because the component is constructed dynamically within another component, without any url/path changes.&amp;nbsp; I suppose it might be hypothetically possible to make this approach work by restructuring the parent component so all child components have their own sub-path, but this looks like a major refactoring I would prefer to avoid at this time.)&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2022 21:24:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1151900#M76603</guid>
      <dc:creator>lawsonkendall</dc:creator>
      <dc:date>2022-03-08T21:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Directions widget persistance in Angular Component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1152190#M76610</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/567887"&gt;@lawsonkendall&lt;/a&gt; can you provide a github repo example? I'm not 100% certain I understand the architecture. On the surface the implementation sounds like its unsupported because its intermixing Angular component life-cycle with the ArcGIS widget life-cycle.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;gt; If I can't connect an existing Directions widget (containing already-retrieved route info) to a new view div&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This isn't possible. All of the APIs out-of-the-box widgets have private undocumented dependencies on the MapView (or SceneView), so a widget can't be disconnected from a View and then reattached.&lt;/P&gt;&lt;P&gt;I'm tagging &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/169842"&gt;@Noah-Sager&lt;/a&gt; for any input he may have related to caching route info and programmatic access.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 16:11:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1152190#M76610</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2022-03-09T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: Directions widget persistance in Angular Component</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1152312#M76613</link>
      <description>&lt;P&gt;I kind of knew the answer as I posted the question.&amp;nbsp; I've read and re-read the API for Directions and it doesn't support it.&amp;nbsp; Your response just confirms what I already suspected.&amp;nbsp; Thanks for taking the time to look at this.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 20:09:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/directions-widget-persistance-in-angular-component/m-p/1152312#M76613</guid>
      <dc:creator>lawsonkendall</dc:creator>
      <dc:date>2022-03-09T20:09:35Z</dc:date>
    </item>
  </channel>
</rss>

