SPA with angularjs and scheduler on window object

Hi!

I use the scheduler in a SPA (with angularjs).
Since the scheduler is registered on the window object all configuration and events etc. are persisted once initialized.
But when I use the router (in angular) and navigate to another view the DOM for the scheduler is “destroyed”, but the window.scheduler is persisted. Thus when I initialize the scheduler again it doesn’t work.

Do you have any experience with this scenario?

One solution would be if there was a way of destroying the scheduler. Is that possible?

Other possible solutions?

a) The enterprise version of Scheduler allows to create a multiple instances of Scheduler. So each time when you need to render a scheduler you can create a new instance.

b) technically, you can call scheduler.init second time, and it will reinit the scheduler on a different HTML container ( old data, events and configurations will be preserved )

a) We are soon going to use the enterprise version, so that might be an option.

b) technically yes, but in practice, for us, no. Just an empty screen.

(b) works for me

Check docs.dhtmlx.com/scheduler/snippet/db3ea8fa

Yes, though we are rendereing on same container (though rendered again). And it’s true, it actually works. Though we have quite heavy configuration/initialization that we don’t want to do twice, like adding marked timespans. And we don’t want to soil our code with “isAlreadyInitialized” or similar.

Though we found another solution. Worth sharing. In our angular routing, we found an extension called “sticky state” christopherthielen.github.io/ui- … s/#/sticky This way we can keep the DOM (view). Just hidden. No re-init ever happens.