function injectKeyLockState(key): Signal<boolean | null>;Defined in: injectKeyLockState.ts:39
Angular inject-based API that returns a signal of whether a lock key, such as Caps Lock, is on.
Lock keys toggle instead of being held, so this reads the lock state that the browser reports on key and mouse events. The signal is null until the user presses a key, clicks, or moves the mouse, after the window loses focus or the page is hidden, and always for Num Lock and Scroll Lock on macOS and iOS.
MaybeGetter<LockKey>
'CapsLock', 'NumLock', or 'ScrollLock' - can be a getter function
Signal<boolean | null>
Signal that is true when the lock is on, false when it is off, or null
@Component({
template: `
<label>
Password
<input type="password" />
@if (capsLock()) {
<span role="status">Caps Lock is on</span>
}
</label>
`,
})
export class PasswordFieldComponent {
capsLock = injectKeyLockState('CapsLock')
}