@angular/core#ViewContainerRef TypeScript Examples

The following examples show how to use @angular/core#ViewContainerRef. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: pagination.directive.ts    From angular-custom-material-paginator with MIT License 6 votes vote down vote up
constructor(
    @Host() @Self() @Optional() private readonly matPag: MatPaginator,
    private readonly ViewContainer: ViewContainerRef,
    private readonly renderer: Renderer2
  ) {
    this.currentPage = 1;
    this.pageGapTxt = ['•••', '---'];
    this.showTotalPages = 3;
    this.checkPage = [0, 0, 0];
    // Display custom range label text
    this.matPag._intl.getRangeLabel = (page: number, pageSize: number, length: number): string => {
      const startIndex = page * pageSize;
      const endIndex = startIndex < length ?
        Math.min(startIndex + pageSize, length) :
        startIndex + pageSize;
      return length > 0 ? 'Showing ' + (startIndex + 1) + ' – ' + endIndex + ' of ' + length + ' records' : 'Showing 0 – 0 of 0 records';
    };
    // Subscribe to rerender buttons when next page and last page button is used
    this.matPag.page.subscribe((paginator: PageEvent) => {
      this.currentPage = paginator.pageIndex;
      this.matPag.pageIndex = paginator.pageIndex;
      this.initPageRange();
    });
  }
Example #2
Source File: autocomplete.directive.ts    From alauda-ui with MIT License 6 votes vote down vote up
constructor(
    overlay: Overlay,
    viewContainerRef: ViewContainerRef,
    elRef: ElementRef<HTMLInputElement>,
    renderer: Renderer2,
    cdr: ChangeDetectorRef,
    ngZone: NgZone,
    @Optional()
    @Host()
    private readonly ngControl: NgControl,
  ) {
    super(overlay, viewContainerRef, elRef, renderer, cdr, ngZone);
    this.type = TooltipType.Plain;
    this.trigger = TooltipTrigger.Manual;
    this.position = 'bottom start';
    this.hideOnClick = true;
  }
Example #3
Source File: closable.directive.ts    From halstack-angular with Apache License 2.0 6 votes vote down vote up
constructor(
    public elementRef: ElementRef,
    public viewContainerRef: ViewContainerRef,
    @Optional() parent: DxcHeaderComponent
  ) {
    if (parent) {
      this.parent = parent;
    }
  }
Example #4
Source File: color-picker.component.ts    From angular-material-components with MIT License 6 votes vote down vote up
constructor(private _dialog: MatDialog,
    private _overlay: Overlay,
    private _zone: NgZone,
    private _adapter: ColorAdapter,
    @Optional() private _dir: Directionality,
    @Inject(NGX_MAT_COLOR_PICKER_SCROLL_STRATEGY) scrollStrategy: any,
    @Optional() @Inject(DOCUMENT) private _document: any,
    private _viewContainerRef: ViewContainerRef) {
    this._scrollStrategy = scrollStrategy;
  }
Example #5
Source File: datetime-picker.component.ts    From ngx-mat-datetime-picker with MIT License 6 votes vote down vote up
constructor(private _dialog: MatDialog,
    private _overlay: Overlay,
    private _ngZone: NgZone,
    private _viewContainerRef: ViewContainerRef,
    @Inject(MAT_DATEPICKER_SCROLL_STRATEGY) scrollStrategy: any,
    @Optional() private _dateAdapter: NgxMatDateAdapter<D>,
    @Optional() private _dir: Directionality,
    @Optional() @Inject(DOCUMENT) private _document: any) {
    if (!this._dateAdapter) {
      throw createMissingDateImplError('NgxMatDateAdapter');
    }

    this._scrollStrategy = scrollStrategy;
  }
Example #6
Source File: tour-anchor.directive.ts    From ngx-ui-tour with MIT License 6 votes vote down vote up
constructor(
    private componentFactoryResolver: ComponentFactoryResolver,
    private injector: Injector,
    private viewContainer: ViewContainerRef,
    private element: ElementRef,
    private tourService: NgxmTourService,
    private tourStepTemplate: TourStepTemplateService,
    private tourBackdrop: TourBackdropService
  ) {
    this.opener = this.viewContainer.createComponent(
      this.componentFactoryResolver.resolveComponentFactory(
        TourAnchorOpenerComponent
      )
    ).instance;
  }
Example #7
Source File: np-data-grid.component.ts    From np-ui-lib with MIT License 6 votes vote down vote up
constructor(
    private filterService: NpFilterService,
    private utilityService: NpGridUtilityService,
    private oDataService: NpODataService,
    private fileService: NpFileService,
    public overlay: Overlay,
    private viewContainerRef: ViewContainerRef,
    private overlayPositionBuilder: OverlayPositionBuilder,
    private dialogService: NpDialogService,
    private translationsService: NpTranslationsService,
    private elementRef: ElementRef
  ) {
    this.sortColumnList = [];
    this.filtersList = Filters;
    this.filterColumnList = [];
    this.stateList = [];
    this.currentStateName = "";
    this.isFilterAvailable = false;
    this.showFilters = true;
  }
Example #8
Source File: load-component.service.ts    From sba-angular with MIT License 6 votes vote down vote up
/**
     * Dynamically load a component from its type. The component's inputs and outputs will be initialized
     * by calling {@link #bindComponent}.
     *
     * @param options The options containing the component to load and its inputs and outputs
     * @param viewContainerRef Specifies where the loaded component should be attached. If not specified then the
     * loaded component is inserted before the application component
     * @param injector Overrides the injector to use as the parent for the component. By default this will be
     * the injector held on the `viewContainerRef`
     */
    loadComponent<T>(options: LoadComponentOptions, viewContainerRef?: ViewContainerRef, injector?: Injector): LoadedComponent {
        let componentRef: ComponentRef<T>;
        let factory = this.factories.get(options.component);
        if (!factory) {
            factory = this.componentFactoryResolver.resolveComponentFactory(options.component);
        }
        if (!viewContainerRef) {
            const appElement: Element = this.applicationRef.components[0].location.nativeElement;
            const injector1 = this.applicationRef.components[0].injector;
            componentRef = factory.create(injector1, [[appElement]]);
            this.applicationRef.attachView(componentRef.hostView);
            if (appElement.parentElement) {
                appElement.parentElement.insertBefore(componentRef.location.nativeElement, appElement.nextSibling);
            }
        }
        else {
            if (!injector) {
                injector = viewContainerRef.injector;
            }
            const index = !Utils.isEmpty(options.index) ? options.index : undefined;
            componentRef = viewContainerRef.createComponent(factory, index, injector, []);
        }
        const loadedComponent: LoadedComponent = {
            componentRef
        };
        this._bindComponent(options, loadedComponent, true);
        loadedComponent.componentRef.changeDetectorRef.detectChanges();
        return loadedComponent;
    }
Example #9
Source File: tutorial-trigger.directive.ts    From bdc-walkthrough with MIT License 5 votes vote down vote up
constructor(private ngZone: NgZone,
              private tutorialService: BdcWalkService,
              private __overlay: Overlay, private __elementRef: ElementRef<HTMLElement>, private __dir: Directionality,
              __viewContainerRef: ViewContainerRef, __focusMonitor: FocusMonitor,
              @Inject(MAT_MENU_SCROLL_STRATEGY) private __scrollStrategy) {

    super(__overlay, __elementRef, __viewContainerRef, __scrollStrategy, null, null, __dir, __focusMonitor);
  }
Example #10
Source File: loading.directive.ts    From xBull-Wallet with GNU Affero General Public License v3.0 5 votes vote down vote up
constructor(
    private readonly el: ElementRef,
    private readonly vcr: ViewContainerRef,
    private readonly renderer: Renderer2,
    private readonly componentFactoryResolver: ComponentFactoryResolver,
  ) { }
Example #11
Source File: let.directive.ts    From rubic-app with GNU General Public License v3.0 5 votes vote down vote up
constructor(_viewContainer: ViewContainerRef, _templateRef: TemplateRef<LetContext<T>>) {
    _viewContainer.createEmbeddedView(_templateRef, this._context);
  }
Example #12
Source File: feature-toggle.directive.ts    From canopy with Apache License 2.0 5 votes vote down vote up
constructor(
    private lgFeatureToggleService: LgFeatureToggleService,
    private templateRef: TemplateRef<any>,
    private viewContainer: ViewContainerRef,
    @Optional()
    @Inject(togglesOptionsInjectable)
    private options?: LgFeatureToggleOptions,
  ) {}
Example #13
Source File: window.component.ts    From nica-os with MIT License 5 votes vote down vote up
constructor(
    public utilityService: UtilityService,
    private store$: Store<AppState>,
    private viewContainerRef: ViewContainerRef,
    private componentFactoryResolver: ComponentFactoryResolver,
    private cd: ChangeDetectorRef
  ) {}
Example #14
Source File: app-datagrid.component.ts    From barista with Apache License 2.0 5 votes vote down vote up
@ViewChild('cellTemplate', { read: ViewContainerRef, static: true })
  selectedColumns: DataGridColumn[];
Example #15
Source File: social-card.component.ts    From Angular-Cookbook with MIT License 5 votes vote down vote up
@ViewChild('vrf', { read: ViewContainerRef }) vrf: ViewContainerRef;
Example #16
Source File: current-stock.component.ts    From pantry_party with Apache License 2.0 5 votes vote down vote up
constructor(
    private grocyService: GrocyService,
    private bottomSheet: BottomSheetService,
    private containerRef: ViewContainerRef,
    private stateTransfer: StateTransferService
  ) {
    this.getNewStock();
  }
Example #17
Source File: aem-component.directive.ts    From aem-angular-editable-components with Apache License 2.0 5 votes vote down vote up
constructor(
    private renderer: Renderer2,
    private viewContainer: ViewContainerRef,
    private compiler: Compiler,
    private injector: Injector,
    private factoryResolver: ComponentFactoryResolver,
    private _changeDetectorRef: ChangeDetectorRef) {
  }
Example #18
Source File: dialog-config.ts    From alauda-ui with MIT License 5 votes vote down vote up
viewContainerRef?: ViewContainerRef;
Example #19
Source File: use-media.directive.ts    From router with MIT License 5 votes vote down vote up
constructor(
    private readonly viewContainer: ViewContainerRef,
    private readonly template: TemplateRef<unknown>
  ) {}
Example #20
Source File: editor.component.ts    From t3mpl-editor with MIT License 5 votes vote down vote up
@ViewChild('container', { static: true, read: ViewContainerRef })
	public container: ViewContainerRef;
Example #21
Source File: for-roles.directive.ts    From budget-angular with GNU General Public License v3.0 5 votes vote down vote up
constructor(
    private viewContainer: ViewContainerRef,
    private templateRef: TemplateRef<any>,
    private authService: AuthService
  ) {}
Example #22
Source File: widget.directive.ts    From json-schema-form with Apache License 2.0 5 votes vote down vote up
/**
     * allow caller to dynamically insert custom component
     * @param viewContainerRef  dynamic component handle
     */
    constructor(public viewContainerRef: ViewContainerRef) { }
Example #23
Source File: data-row-outlet.directive.ts    From halstack-angular with Apache License 2.0 5 votes vote down vote up
constructor(
    public viewContainer: ViewContainerRef,
    public elementRef: ElementRef
  ) {}
Example #24
Source File: ngx-tippy.directive.ts    From ngx-tippy-wrapper with MIT License 5 votes vote down vote up
constructor(
    private tippyEl: ElementRef,
    private renderer: Renderer2,
    private ngxTippyService: NgxTippyService,
    private ngxViewService: NgxViewService,
    private viewContainerRef: ViewContainerRef,
    @Inject(PLATFORM_ID) private platform: Object
  ) {}
Example #25
Source File: results-list-item.component.ts    From geonetwork-ui with GNU General Public License v2.0 5 votes vote down vote up
@ViewChild('card', { read: ViewContainerRef }) cardRef: ViewContainerRef
Example #26
Source File: golden-layout-host.component.ts    From golden-layout-ng-app with MIT License 5 votes vote down vote up
@ViewChild('componentViewContainer', { read: ViewContainerRef, static: true }) private _componentViewContainerRef: ViewContainerRef;
Example #27
Source File: ad.directive.ts    From ng-ant-admin with MIT License 5 votes vote down vote up
constructor(public viewContainerRef: ViewContainerRef) {}
Example #28
Source File: panel-chart.component.ts    From EDA with GNU Affero General Public License v3.0 5 votes vote down vote up
@ViewChild('chartComponent', { read: ViewContainerRef, static: true }) entry: ViewContainerRef;
Example #29
Source File: render-app.directive.ts    From angular-dream-stack with MIT License 5 votes vote down vote up
constructor(
    private readonly templateRef: TemplateRef<unknown>,
    private readonly viewContainerRef: ViewContainerRef
  ) {}