import { Component, Input, OnInit, Inject } from '@angular/core'; import { CommonModule } from '@angular/common'; import { MatToolbarModule } from '@angular/material/toolbar'; import { P3xrButtonComponent } from './p3xr-button.component'; import { I18nService } from '../services/i18n.service'; import { RedisStateService } from '../services/redis-state.service'; /** * Error page component — Angular standalone replacement for AngularJS p3xrError. * * Displays Socket.IO connection error with a reload button. * During hybrid mode, receives $stateParams.error via the downgraded binding. * * AngularJS usage: (routed via UI-Router) * Downgraded usage: */ @Component({ selector: 'p3xr-ng-error', standalone: true, imports: [CommonModule, MatToolbarModule, P3xrButtonComponent], template: ` {{ strings().title?.socketioConnectError || 'Connection Error' }}


{{ error?.message }}

`, }) export class P3xrErrorComponent implements OnInit { @Input() error: any; strings; constructor( @Inject(I18nService) private i18n: I18nService, @Inject(RedisStateService) private state: RedisStateService, ) { this.strings = this.i18n.strings; } ngOnInit(): void { this.state.failed.set(true); } reload(): void { location.href = '/'; } }