![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@ultimate/ngx-fullscreen
Advanced tools
📺 @ultimate/ngx-fullscreen Angular Directive that implements the <a href="https://developer.mozilla.org/en
Install via npm i @ultimate/ngx-fullscreen
and register the NgxFullscreenModule
into an @NgModule
.
Check the StackBlitz demo and the example code.
NgxFullscreenDirective
can be used in both template and component (when queried with @ViewChild
).
Entire Document: To fullscreen the document
just add ngxFullscreen
into a component template. Internally this uses the document.documentElement
to enter fullscreen:
<!-- Registers the whole Document -->
<div ngxFullscreen></div>
Elements: Create a Template Ref, e.g. #video
for the element you wish to fullscreen and pass it into [ngxFullscreen]
:
<!-- Registers just this Element -->
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
></video>
Export the ngxFullscreen
directive to a Template Ref, e.g. #fullscreen
and call enter()
:
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
#fullscreen="ngxFullscreen"
></video>
<button (click)="fullscreen.enter()">
Enter Fullscreen
</button>
The enter()
method also accepts an optional Element
to pass a dynamic element.
Use the exit()
method to exit fullscreen mode:
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
#fullscreen="ngxFullscreen"
></video>
<button (click)="fullscreen.exit()">
Exit Fullscreen
</button>
Use the toggle()
method to toggle fullscreen mode:
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
#fullscreen="ngxFullscreen"
></video>
<button (click)="fullscreen.toggle()">
Toggle Fullscreen
</button>
The toggle()
method also accepts an optional Element
to pass a dynamic element.
Fires entering and exiting fullscreen mode, using the fullscreenchange
event behind-the-scenes:
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
#fullscreen="ngxFullscreen"
(transition)="onTransition($event)"
></video>
The $event
is of type NgxFullscreenTransition
, contains the fullscreen status and element that is/was fullscreened.
Check if fullscreen mode is active via fullscreen.isFullscreen
. Returns true
or false
.
<video
src="trailer.mp4"
#video
[ngxFullscreen]="video"
#fullscreen="ngxFullscreen"
></video>
Fullscreen Mode: {{ fullscreen.isFullscreen ? 'Active' : 'Inactive' }}
The fullscreen element will receive an active class is-fullscreen
via a @HostBinding
.
The NgxFullscreenDirective
is exposed when queried with @ViewChild
, any public methods and properties are also accessible.
Use a @ViewChild
query and call any property as you would inside the template.
import {
NgxFullscreenDirective,
NgxFullscreenTransition
} from '@ultimate/ngx-fullscreen';
@Component({...})
export class AppComponent implements AfterViewInit {
@ViewChild('fullscreen') fullscreen!: NgxFullscreenDirective;
onClick() {
this.fullscreen.toggle();
}
enterFullscreen() {
this.fullscreen.enter();
}
exitFullscreen() {
this.fullscreen.exit();
}
ngAfterViewInit() {
this.fullscreen.transition
.subscribe((change: NgxFullscreenTransition) => {
console.log(change); // { isFullscreen: boolean, element: Element }
});
}
}
Fullscreen errors are caught when entering and exiting and are passed from the directive via an errors
event:
@Component({...})
export class AppComponent implements AfterViewInit {
@ViewChild('fullscreen') fullscreen!: NgxFullscreenDirective;
ngAfterViewInit() {
this.fullscreen.errors.subscribe((err: string) => {
// e.g. "Failed to execute 'requestFullscreen' on 'Element'"
console.log(err);
});
}
}
Due to the Permissions API, you cannot invoke Fullscreen mode unless it is from a user action, such as a click event.
This means you cannot load a page and behind the scenes invoke a successful Fullscreen request. This is a common source of errors so keep that in mind.
FAQs
📺 @ultimate/ngx-fullscreen Angular Directive that implements the <a href="https://developer.mozilla.org/en
We found that @ultimate/ngx-fullscreen demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.