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.
npm i @christophhu/ngx-debug-mode
<debug-mode></debug-mode>
<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$
}
}