How to use the @angular/cdk/portal.PortalInjector function in @angular/cdk

To help you get started, we’ve selected a few @angular/cdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opf / openproject / frontend / src / app / components / wp-table / external-configuration / external-query-configuration.service.ts View on Github external
private injectorFor(data:any) {
    const injectorTokens = new WeakMap();
    // Pass the service because otherwise we're getting a cyclic dependency between the portal
    // host service and the bound portal
    data.service = this;

    injectorTokens.set(OpQueryConfigurationLocalsToken, data);

    return new PortalInjector(this.injector, injectorTokens);
  }
github project-flogo / flogo-web / libs / lib-client / core / src / confirmation / confirmation.service.ts View on Github external
private createInjector(
    customTokens: WeakMap,
    control: ConfirmationControl
  ): PortalInjector {
    const injectionTokens = customTokens || new WeakMap();
    injectionTokens.set(ConfirmationControl, control);
    return new PortalInjector(this.injector, injectionTokens);
  }
github QuinntyneBrown / CodeWithQB / src / CodeWithQB.ClientApp / src / app / core / overlay.service.ts View on Github external
private attachOverlayContainer(overlayRef, overlayRefWrapper, injectionTokens: WeakMap) {
    const injector = new PortalInjector(this._injector, injectionTokens);
    const overlayPortal = new ComponentPortal(this._component, null, injector);
    const overlayPortalRef: ComponentRef = overlayRef.attach(overlayPortal);
    return overlayPortalRef.instance;
  }
}
github seokju-na / geeks-diary / src / browser / note / note-editor / note-snippet-list-manager.ts View on Github external
private createInjector>(
        config: NoteSnippetEditorConfig,
        ref: NoteSnippetEditorRef,
    ): PortalInjector {
        const injectionTokens = new WeakMap([
            [NoteSnippetEditorRef, ref],
            [NoteSnippetEditorConfig, config],
        ]);

        return new PortalInjector(this.injector, injectionTokens);
    }
github DanielYKPan / date-time-picker / src / dialog / dialog.service.ts View on Github external
private createInjector( config: OwlDialogConfig, dialogRef: OwlDialogRef, dialogContainer: OwlDialogContainerComponent ) {
        const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;
        const injectionTokens = new WeakMap();

        injectionTokens.set(OwlDialogRef, dialogRef);
        injectionTokens.set(OwlDialogContainerComponent, dialogContainer);
        injectionTokens.set(OWL_DIALOG_DATA, config.data);

        return new PortalInjector(userInjector || this.injector, injectionTokens);
    }
github FrogTheFrog / steam-gyro-for-cemuhook / src / frontend / app / message-log / message-log.service.ts View on Github external
private createInjector(message: MessageObject, messageRef: MessageOverlayRef) {
        const injectionTokens = new WeakMap();

        injectionTokens.set(MessageOverlayRef, messageRef);
        injectionTokens.set(MESSAGE_OBJECT_DATA, message.data);

        return new PortalInjector(this.injector, injectionTokens);
    }
github angular / components / src / material / snack-bar / snack-bar.ts View on Github external
private _createInjector(
      config: MatSnackBarConfig,
      snackBarRef: MatSnackBarRef): PortalInjector {

    const userInjector = config && config.viewContainerRef && config.viewContainerRef.injector;

    return new PortalInjector(userInjector || this._injector, new WeakMap([
      [MatSnackBarRef, snackBarRef],
      [MAT_SNACK_BAR_DATA, config.data]
    ]));
  }
}
github project-flogo / flogo-web / libs / lib-client / modal / src / modal.service.ts View on Github external
private createInjector(
    customTokens: WeakMap,
    control: ModalInstance
  ): PortalInjector {
    const injectionTokens = customTokens || new WeakMap();
    injectionTokens.set(ModalInstance, control);
    return new PortalInjector(this.injector, injectionTokens);
  }
github thingsboard / thingsboard / ui-ngx / src / app / modules / home / components / attribute / attribute-table.component.ts View on Github external
overlayY: 'center'
    };
    config.positionStrategy = this.overlay.position().flexibleConnectedTo(target as HTMLElement)
      .withPositions([connectedPosition]);

    const overlayRef = this.overlay.create(config);
    overlayRef.backdropClick().subscribe(() => {
      overlayRef.dispose();
    });
    const injectionTokens = new WeakMap([
      [EDIT_ATTRIBUTE_VALUE_PANEL_DATA, {
        attributeValue: attribute.value
      } as EditAttributeValuePanelData],
      [OverlayRef, overlayRef]
    ]);
    const injector = new PortalInjector(this.viewContainerRef.injector, injectionTokens);
    const componentRef = overlayRef.attach(new ComponentPortal(EditAttributeValuePanelComponent,
      this.viewContainerRef, injector));
    componentRef.onDestroy(() => {
      if (componentRef.instance.result !== null) {
        const attributeValue = componentRef.instance.result;
        const updatedAttribute = {...attribute};
        updatedAttribute.value = attributeValue;
        this.attributeService.saveEntityAttributes(this.entityIdValue,
          this.attributeScope as AttributeScope, [updatedAttribute]).subscribe(
          () => {
            this.reloadAttributes();
          }
        );
      }
    });
  }
github ng-vcl / ng-vcl / lib / ng-vcl / src / layer / component-layer-ref.ts View on Github external
protected createPortal(): ComponentPortal {
    const injectionTokens = new WeakMap();
    injectionTokens.set(ComponentLayerRef, this);
    const portalInjector = new PortalInjector(this.injector, injectionTokens);
    return new ComponentPortal(this.componentType, this.opts.viewContainerRef, portalInjector);
  }