File

libs/common/headline/src/headline.component.ts

Metadata

import { TalyInternalHeadlineComponent } from '@allianz/taly-core/internal-headline';
import { CommonModule } from '@angular/common';
import { Component, inject } from '@angular/core';
import { ConfiguredSectionDirective } from './configured-section.directive';

@Component({
  selector: 'taly-headline',
  templateUrl: './headline.component.html',
  styleUrl: './headline.component.scss',
  imports: [CommonModule, TalyInternalHeadlineComponent]
})
export class TalyHeadlineComponent {
  protected isInsideSection = Boolean(
    inject(ConfiguredSectionDirective, {
      optional: true,
      skipSelf: true
    })
  );
}
<ng-container *ngIf="isInsideSection">
  <taly-internal-headline type="subsection" data-testid="subsectionHeadline">
    <ng-container *ngTemplateOutlet="content"></ng-container>
  </taly-internal-headline>
</ng-container>

<ng-container *ngIf="!isInsideSection">
  <taly-internal-headline type="section" data-testid="sectionHeadline">
    <ng-container *ngTemplateOutlet="content"></ng-container>
  </taly-internal-headline>
</ng-container>

<ng-template #content><ng-content></ng-content></ng-template>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""