File

src/lib/sidenav/version/version.component.ts

Implements

OnInit OnDestroy

Metadata

Index

Properties

Constructor

constructor(version: VersionService)
Parameters :
Name Type Optional
version VersionService No

Properties

Public modules
Type : KeyValue<Version>
import {
  ChangeDetectionStrategy,
  Component,
  Inject,
  OnDestroy,
  OnInit,
} from '@angular/core';
import {
  Version,
  VersionService,
} from '@rxap/services';
import {
  KeyValue,
  Required,
} from '@rxap/utilities';
import { tap } from 'rxjs/operators';
import { Subscription } from 'rxjs';
import {
  KeyValuePipe,
  NgFor,
} from '@angular/common';

@Component({
  selector: 'rxap-version',
  templateUrl: './version.component.html',
  styleUrls: [ './version.component.scss' ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  standalone: true,
  imports: [ NgFor, KeyValuePipe ],
})
export class VersionComponent implements OnInit, OnDestroy {

  public modules!: KeyValue<Version>;

  private subscription?: Subscription;

  constructor(
    @Inject(VersionService) private version: VersionService,
  ) {
  }

  public ngOnInit(): void {
    this.modules = this.version.get();
    this.subscription = this.version.update$.pipe(
      tap(() => this.modules = this.version.get()),
    ).subscribe();
  }

  public ngOnDestroy() {
    this.subscription?.unsubscribe();
  }

}
<div class="version flex flex-col gap-2">
  <div *ngFor="let module of modules | keyvalue" class="flex flex-col">
    <span class="name grow-0">{{module.value.name}}</span>
    <span class="semantic grow-0">{{module.value.semantic}}</span>
    <span class="hash grow-0">{{module.value.hash}}</span>
  </div>
</div>

./version.component.scss

.version {
  width: 100%;
  font-size: 9px;
  padding: 8px;

  .name {
    padding-bottom: 12px;
    font-size: 10px;
  }

}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""