src/app/core/common-components/view-actions/view-actions.component.ts
Building block for views, providing a consistent layout to action buttons and menus for both dialog and routed views.
AfterViewInit
selector | app-view-actions |
imports |
NgTemplateOutlet
|
templateUrl | ./view-actions.component.html |
Properties |
constructor(viewContext: ViewComponentContext)
|
||||||
Parameters :
|
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>
}