Select to view content in your preferred language

Cleaner way of coding Popup Template

694
1
Jump to solution
04-23-2021 12:29 PM
Labels (1)
Seadreamer
New Contributor

Instead of storing html in JavaScript popuptemplate variable (see below), is there a way to save popup template as an html file and pass a JavaScript object to the html?

Currently following code is working for me. Just trying to find a cleaner way.

var popupTemplate = (o) =>
`<div>${o.variable_name}</div>`

Any other ideas are welcome too.

Thanks in advance for your help!

 

0 Kudos
1 Solution

Accepted Solutions
GavinRehkemper
Esri Contributor

I think that's a good way to do it. This sample uses L.Util.template which is a slightly different way to do it, so that's an alternative for you too.

View solution in original post

0 Kudos
1 Reply
GavinRehkemper
Esri Contributor

I think that's a good way to do it. This sample uses L.Util.template which is a slightly different way to do it, so that's an alternative for you too.

0 Kudos