TX Text Control for Angular is created as a singleton instance on a page. Therefore, the complete control must be removed explicitly from the DOM when loading a partial view a second time. In Angular, "partial views" are implemented through routes. In this sample, two routes are implemented:
The component home and textcontrol are navigated through links on the main app page:
Due to the nature of Angular routes, the page is not reloaded when clicking on the navigation links, but a partial views is loaded dynamically into the DOM.
This method is declared in app.component.ts:
╰ TXTextControl Object
╰ removeFromDom Method
Closes the WebSocket connection gracefully and removes the whole editor from the DOM. method that closes the WebSocket connection gracefully and removes the whole editor from the DOM.
This way, a new partial view can be loaded and reused including a Text Control editor with a new and safe connection to the WebSocketHandler.