File

src/lib/header/header.component.ts

Metadata

Index

Properties
Inputs

Inputs

color

Properties

Public Readonly color
Public Readonly hasPortals
Default value : computed(() => this.portals().length > 0)
Protected Readonly headerService
Default value : inject(HeaderService)
Public Readonly portals
Default value : computed(() => this.headerService.portals())
import { CdkPortalOutlet } from '@angular/cdk/portal';
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  inject,
  input,
} from '@angular/core';
import { ThemePalette } from '@angular/material/core';
import {
  MatToolbar,
  MatToolbarRow,
} from '@angular/material/toolbar';
import { HeaderService } from '../header.service';

@Component({
    selector: 'rxap-header',
    templateUrl: './header.component.html',
    styleUrls: ['./header.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush,
    imports: [
        MatToolbar,
        MatToolbarRow,
        CdkPortalOutlet,
    ]
})
export class HeaderComponent {

  public readonly color = input<ThemePalette>();

  protected readonly headerService = inject(HeaderService);

  public readonly portals = computed(() => this.headerService.portals());
  public readonly hasPortals = computed(() => this.portals().length > 0);

}
@if (hasPortals()) {
  <mat-toolbar [color]="color()" class="mat-elevation-z1">
    @for (portal of portals(); track portal) {
      <mat-toolbar-row>
        <ng-template [cdkPortalOutlet]="portal"></ng-template>
      </mat-toolbar-row>
    }
  </mat-toolbar>
}

./header.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""