Displays a container in full screen mode
npm install ngx-fullscreen-directiveDisplays a container in full screen mode. Requires Angular version >= 15.0.0.
- npm i ngx-fullscreen-directive
- Import FullScreenDirective in a @NgModule
- Add the directive to the container which needs to be maximized
``html
...
`
You can define custom styles to the container while it is displayed in full screen mode by sending an object of type CSSStyleDeclaration to the fullScreenCtrStyle input property of the directive. These styles will be rolled-back after the full screen mode is exited:
`typescript`
customStyles = {
/your styles/
} as CSSStyleDeclaration;
`html`
You can handle fullScreenEnabled event which notifies whether the full screen mode is toggled on.
`html`
...
`typescript
onFullScreenToggle(enabled: boolean) {
}
`
and closeFullScreen() from component .ts fileBy handling fullScreenInit event, you get access to the openFullScreen() and closeFullScreen() directive functions into your component's .ts file
`html`
`typescript
onFullScreenInit(instance: FullScreenInstance) {
this._fullScreenInstance = instance
}
...
//toggle on full screen
this._fullScreenInstance.openFullScreen();
//toggle off full screen
this._fullScreenInstance.closeFullScreen();
``