Skip to content

Commit

Permalink
✨ feat(app.component.ts, app.config.ts): Enhance documentation wi…
Browse files Browse the repository at this point in the history
…th detailed JSDoc comments and clean up import statements
  • Loading branch information
vnobo committed Feb 15, 2025
1 parent e33c8ff commit c448d0e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
27 changes: 27 additions & 0 deletions ng-ui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ import { MatProgressBarModule } from '@angular/material/progress-bar';
import { NavigationEnd, NavigationError, NavigationStart, Router, RouterOutlet } from '@angular/router';
import { VERSION as VERSION_ZORRO } from 'ng-zorro-antd/version';

/**
* The root component of the application.
*
* @selector app-root
* @imports RouterOutlet, MatProgressBarModule, NgIf
* @template
* Contains a fixed-top progress bar that is displayed during navigation events
* and a router outlet for displaying routed components.
* @styles
* Ensures the host element takes up the full height and width of the viewport.
*/
@Component({
selector: 'app-root',
imports: [RouterOutlet, MatProgressBarModule, NgIf],
Expand All @@ -23,14 +34,30 @@ import { VERSION as VERSION_ZORRO } from 'ng-zorro-antd/version';
],
})
export class AppComponent implements OnInit {
/**
* Signal to control the visibility of the progress bar.
*/
progressShow = signal(false);

/**
* Router instance for subscribing to navigation events.
*/
private readonly router = inject(Router);

/**
* Constructs the AppComponent and sets initial attributes on the host element.
*
* @param el - The element reference of the host element.
* @param renderer - The renderer for manipulating the DOM.
*/
constructor(el: ElementRef, renderer: Renderer2) {
renderer.setAttribute(el.nativeElement, 'ng-zorro-version', VERSION_ZORRO.full);
//renderer.setAttribute(el.nativeElement.parentElement, 'data-bs-theme', 'dark');
}

/**
* Initializes the component and subscribes to router events to control the progress bar visibility.
*/
ngOnInit(): void {
let configLoad = false;
this.router.events.subscribe(event => {
Expand Down
16 changes: 2 additions & 14 deletions ng-ui/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
import {
ApplicationConfig,
importProvidersFrom,
LOCALE_ID,
provideExperimentalZonelessChangeDetection,
} from '@angular/core';
import { ApplicationConfig, importProvidersFrom, LOCALE_ID, provideExperimentalZonelessChangeDetection } from '@angular/core';
import { provideRouter, withComponentInputBinding } from '@angular/router';

import {
provideHttpClient,
withFetch,
withInterceptors,
withInterceptorsFromDi,
withXsrfConfiguration,
} from '@angular/common/http';
import { provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withXsrfConfiguration } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';

Expand Down Expand Up @@ -52,6 +41,5 @@ export const appConfig: ApplicationConfig = {
{ provide: LOCALE_ID, useValue: 'zh_CN' },
provideRouter(routes, withComponentInputBinding()),
provideExperimentalZonelessChangeDetection(),
provideAnimationsAsync(), provideAnimationsAsync(),
],
};

0 comments on commit c448d0e

Please sign in to comment.