HelpBot Assistant

How can I help you?

State persistence in EJ2 TypeScript Maps component

6 Feb 20261 minute to read

State persistence enables the Maps component to retain the current state in browser storage for state maintenance across page refreshes. This feature is controlled through the enablePersistence property which is set to false by default. When this property is set to true, specific Maps component model values are preserved even after the page is refreshed.

import { world_map } from './world-map.ts';
import { Maps, Selection, Zoom } from '@syncfusion/ej2-maps';
Maps.Inject(Selection, Zoom);
let map: Maps = new Maps({
    enablePersistence:true,
    zoomSettings:{
        enable:true
    },
    layers: [{
        shapeData: world_map
    }]
});
map.appendTo('#element');