elements
require(["esri/form/support/elements"], function(elements) { /* code goes here */ });
Object:
esri/form/support/elements
Since: ArcGIS API for JavaScript 4.16
A convenience module for importing Element classes when developing with TypeScript. For example, rather than importing form elements one at a time like this:
import FieldElement from "esri/form/elements/FieldElement";
import GroupElement from "esri/form/elements/GroupElement";
You can use this module to import them on a single line:
import { FieldElement, GroupElement } from "esri/form/elements";
This module also allows you to implement type guards on the form elements, making your code smarter.
import { Element } from "esri/form/elements";
function logFormElement(element: Element): void {
if (element.type === "field") {
console.log("Form element type is field");
}
else {
// The compiler knows the content element must be `field | group`
console.log("The value is not a valid form element.")
}
}
- See also:
Loading...