I'm creating a window with the window service and setting a title. But then user selection may change and the contents of the window might change. I can get the instance of the component and change its inputs so the content of the window changes, but how do I change the title of the window without closing it and reopening a new window with a different title?
Hi Noah,
Using a template is the correct approach.
To dynamically change the applied cssClass, use the created Window instance and change the cssClass value like:
public windowRef: WindowRef; public openWindow(): void { this.windowRef = this.windowService.open({ title: 'My Window', ... cssClass: 'redHeader', }); } onClick() { this.windowRef.window.instance.cssClass = 'greenHeader'; }
Here is an example:
https://stackblitz.com/edit/angular-8mjsbg
I hope this helps.
Regards,
Martin