### File

`src/lib/window-footer.directive.ts`

### Implements

`OnInit`

### Metadata

Selector | `[rxapWindowFooter]`
Standalone | `true`

### Index

###### Methods

- Static ngTemplateContextGuard

### Constructor

`constructor(windowRef: WindowRef, template: TemplateRef<WindowFooterTemplateContext>, viewContainerRef: ViewContainerRef)`
Defined in src/lib/window-footer.directive.ts:20

Parameters :

Name | Type | Optional
windowRef | `WindowRef` | No
template | `TemplateRef<WindowFooterTemplateContext>` | No
viewContainerRef | `ViewContainerRef` | No

### Methods

Static ngTemplateContextGuard
`ngTemplateContextGuard(dir: WindowFooterDirective, ctx: any)`
Defined in src/lib/window-footer.directive.ts:38

Asserts the correct type of the context for the template that `NgForOf` will render.

The presence of this method is a signal to the Ivy template type-check compiler that the `NgForOf` structural directive renders its template with a specific context type.

Parameters :

Name | Type | Optional
dir | `WindowFooterDirective` | No
ctx | `any` | No

Returns : `WindowFooterTemplateContext`

    import {
      Directive,
      Inject,
      OnInit,
      TemplateRef,
      ViewContainerRef,
    } from '@angular/core';
    import { WindowRef } from './window-ref';
    import { RXAP_WINDOW_REF } from './tokens';
    import { TemplatePortal } from '@angular/cdk/portal';

    export interface WindowFooterTemplateContext {
      $implicit: WindowRef;
    }

    @Directive({
      selector: '[rxapWindowFooter]',
      standalone: true,
    })
    export class WindowFooterDirective implements OnInit {

      constructor(
        @Inject(RXAP_WINDOW_REF)
        private readonly windowRef: WindowRef,
        @Inject(TemplateRef)
        private readonly template: TemplateRef<WindowFooterTemplateContext>,
        @Inject(ViewContainerRef)
        private readonly viewContainerRef: ViewContainerRef,
      ) {
      }

      /**
       * Asserts the correct type of the context for the template that `NgForOf` will render.
       *
       * The presence of this method is a signal to the Ivy template type-check compiler that the
       * `NgForOf` structural directive renders its template with a specific context type.
       */
      static ngTemplateContextGuard(dir: WindowFooterDirective, ctx: any):
        ctx is WindowFooterTemplateContext {
        return true;
      }

      public ngOnInit() {
        this.windowRef.setFooterPortal(new TemplatePortal<WindowFooterTemplateContext>(
          this.template,
          this.viewContainerRef,
          {
            $implicit: this.windowRef,
          },
        ));
      }

    }

# results matching ""

# No results matching ""