@christophhu/ngx-debug-mode

Angular debug mode toggle library for toggling with local storage support.


Keywords
angular, debugmode, debug, localstorage
License
MIT
Install
npm install @christophhu/ngx-debug-mode@19.2.1

Documentation

Ngx-Debug-Mode

Frameworks and Languages

Static Badge
Static Badge
Static Badge

Demo

image

Description

This Repository contains a simple Angular library for toggling the debug mode. It is designed to be easy to use and integrate into any Angular application. It uses the localStorage-API to save the user's preference for debug mode, so that the setting persists across page reloads.

Installation

npm i @christophhu/ngx-debug-mode

Use

With default toggle

<debug-mode></debug-mode>

With custom toggle

<debug-mode>
  <input type="checkbox" class="toggle" id="toggle" (change)="toggleDebug()"/>
</debug-mode>
import { DebugModeService, DebugModeComponent } from "@christophhu/ngx-debug-mode";

@Component({
  ...
  imports: [
    DebugModeComponent
  ],
  providers: [
    DebugModeService
  ]
})
export class TestComponent {
  
  constructor(private _debugModeService: DebugModeService) {}

  toggleDebug() {
    this._debugModeService.toggleDebug()
  }
  getDebug(): Observable<boolean> {
    return this._debugModeService.debug$
  }
}