AnsweredAssumed Answered

PopupTemplate JavaScript promise for the contents is never being executed.

Question asked by AndrewPage3 on Dec 6, 2017
Latest reply on Mar 19, 2018 by bflessner

Summary:

My PopupTemplate JavaScript promise for the contents is never being executed.

 

My Requirements:

I am attempting to code a feature that will allow the user to click on a graphic in a Feature Layer and see a popup. We have integrated the map into our ASP.Net MVC web application using the JavaScript 4.5 API.

I have coded the popup in JavaScript as a Popup Template. When the user clicks on a graphic (that will represent a map pin-point), I need the code to do an (asynchronous) AJAX HTTP GET to an endpoint in order to retrieve a JSON object. The object will contain some data that will be displayed in the popup.

I have assigned the 'content' property of my PopupTemplate to my JavaScript function that returns a promise.

 

My Problem:

It appears that the promise is never being executed, as breakpoints in my code within the promise are never hit. 

I have tried several ways to code the promise with no success. I am using esriRequest to actually do the AJAX GET, and returning the promise from this as the function assignment. Please see my attached code.

I think the JavaScript API is just executing my function and ignoring the promise that I am returning.

Outcomes