Here is sample code,
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=basemap-gallery
if you move
<arcgis-basemap-gallery position="top-right"></arcgis-basemap-gallery>
outside of
</arcgis-map>
tag,
base map gallery will be disabled automatically.
see my screen.
even in js, I set
"reference-element" is the attribute name, only to be used declaratively.
"referenceElement" is the property name, which be accessed via "element.referenceElement". It would also be used in jsx syntax for various UI libraries.
https://developers.arcgis.com/javascript/latest/programming-patterns/#attributes-and-properties
Here is how to use reference element,
https://developers.arcgis.com/javascript/latest/programming-patterns/
warning: when you use reference element in html tag, you must use exact word "reference-element"
when you use reference element in javascript, must use exact word "referenceElement"
They are not interchangable, otherwise, will not work.
Based on this theory, I correct the online sample as following
When working with the map-components, if a component is not a child of a map or scene component, you can use a "reference-element" attribute to associate them.
the sample works fine, is because
is inside of
based on your advice, I test it like this, it does not work. Unless I did it not the way you means. Please use this online sample as test, explain what you exactly means, how to use reference element?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.