File

src/app/core/common-components/view-actions/view-actions.component.ts

Description

Building block for views, providing a consistent layout to action buttons and menus for both dialog and routed views.

Implements

AfterViewInit

Metadata

Index

Properties

Constructor

constructor(viewContext: ViewComponentContext)
Parameters :
Name Type Optional
viewContext ViewComponentContext No

Properties

template
Type : TemplateRef<any>
Decorators :
@ViewChild('template')
import {
  AfterViewInit,
  Component,
  Optional,
  TemplateRef,
  ViewChild,
} from "@angular/core";
import { NgTemplateOutlet } from "@angular/common";
import { ViewComponentContext } from "../../ui/abstract-view/view-component-context";

/**
 * Building block for views, providing a consistent layout to action buttons and menus
 * for both dialog and routed views.
 */
@Component({
  selector: "app-view-actions",
  templateUrl: "./view-actions.component.html",
  imports: [NgTemplateOutlet],
})
export class ViewActionsComponent implements AfterViewInit {
  @ViewChild("template") template: TemplateRef<any>;

  constructor(@Optional() protected viewContext: ViewComponentContext) {}

  ngAfterViewInit(): void {
    if (this.viewContext) {
      setTimeout(() => (this.viewContext.actions = this));
    }
  }
}
<ng-template #template>
  <ng-content></ng-content>
</ng-template>

@if (!viewContext) {
  <ng-container *ngTemplateOutlet="template"></ng-container>
}
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""