@angular/core#Host TypeScript Examples
The following examples show how to use
@angular/core#Host.
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: autocomplete.directive.ts From alauda-ui with MIT License | 6 votes |
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 #2
Source File: for-track-by-id.directive.ts From onchat-web with Apache License 2.0 | 6 votes |
constructor(
@Host() @Optional() private ngForOf: NgForOf<T>,
@Host() @Optional() private cdkForOf: CdkVirtualForOf<T>,
) {
if (this.ngForOf) {
this.ngForOf.ngForTrackBy = (_index: number, item: T) => item.id;
} else if (this.cdkForOf) {
this.cdkForOf.cdkVirtualForTrackBy = (_index: number, item: T) => item.id;
}
}
Example #3
Source File: modal-drag.directive.ts From ng-ant-admin with MIT License | 6 votes |
constructor(@Host() protected modal: NzModalComponent, public modalDragService: ModalDragService) {
const wrapCls = this.modalDragService.getRandomCls();
modal.afterOpen.subscribe(() => {
const modelElement = modal.getElement()!;
if (!modelElement || modelElement.className.indexOf(ModalDragService.DRAG_CLS_PREFIX) !== -1) {
return;
}
modelElement.classList.add(wrapCls);
const drag = this.modalDragService.createDragHandler(wrapCls, modal.nzModalType);
modal.afterClose.subscribe(() => {
if (drag && !drag.dropped) {
drag.dispose();
}
});
});
}
Example #4
Source File: tour-anchor.directive.ts From ngx-ui-tour with MIT License | 6 votes |
constructor(
private tourService: NgxbTourService,
private tourStepTemplate: TourStepTemplateService,
private element: ElementRef,
@Host() private popoverDirective: TourAnchorNgxBootstrapPopoverDirective,
private tourBackdrop: TourBackdropService
) {
this.popoverDirective.triggers = '';
}
Example #5
Source File: tour-anchor.directive.ts From ngx-ui-tour with MIT License | 6 votes |
constructor(
private tourService: NgbTourService,
private tourStepTemplate: TourStepTemplateService,
private element: ElementRef,
@Host() private popoverDirective: TourAnchorNgBootstrapPopoverDirective,
private tourBackdrop: TourBackdropService
) {
this.popoverDirective.autoClose = false;
this.popoverDirective.triggers = '';
this.popoverDirective.toggle = () => { };
}
Example #6
Source File: toggle.component.ts From canopy with Apache License 2.0 | 6 votes |
constructor(
@Self() @Optional() public control: NgControl,
@Optional()
@Inject(forwardRef(() => LgCheckboxGroupComponent))
private checkboxGroup: LgCheckboxGroupComponent,
private domService: LgDomService,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
private controlContainer: FormGroupDirective,
private hostElement: ElementRef,
) {
this.selectorVariant = this.hostElement.nativeElement.tagName
.split('-')[1]
.toLowerCase();
if (this.checkboxGroup) {
return;
}
if (this.control != null) {
this.control.valueAccessor = this;
}
}
Example #7
Source File: radio-group.component.ts From canopy with Apache License 2.0 | 6 votes |
constructor(
@Self() @Optional() private control: NgControl,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
private controlContainer: FormGroupDirective,
private domService: LgDomService,
private hostElement: ElementRef,
private renderer: Renderer2,
) {
this.variant = this.hostElement.nativeElement.tagName
.split('-')[1]
.toLowerCase() as RadioVariant;
if (this.control != null) {
this.control.valueAccessor = this;
}
}
Example #8
Source File: radio-button.component.ts From canopy with Apache License 2.0 | 6 votes |
constructor(
@Self() @Optional() public control: NgControl,
@Inject(forwardRef(() => LgRadioGroupComponent))
private radioGroup: LgRadioGroupComponent,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
private controlContainer: FormGroupDirective,
private renderer: Renderer2,
private hostElement: ElementRef,
private domService: LgDomService,
) {}
Example #9
Source File: checkbox-group.component.ts From canopy with Apache License 2.0 | 6 votes |
constructor(
@Self() @Optional() private control: NgControl,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
private controlContainer: FormGroupDirective,
private domService: LgDomService,
private renderer: Renderer2,
private hostElement: ElementRef,
) {
this.variant = this.hostElement.nativeElement.tagName
.split('-')[1]
.toLowerCase() as CheckboxGroupVariant;
if (this.control != null) {
this.control.valueAccessor = this;
}
}
Example #10
Source File: pagination.directive.ts From angular-custom-material-paginator with MIT License | 6 votes |
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 #11
Source File: slick-item.directive.ts From flingo with MIT License | 5 votes |
constructor(
public el: ElementRef,
@Inject(PLATFORM_ID) private platformId: string,
@Host() private carousel: SlickCarouselComponent
) {}
Example #12
Source File: installed.component.ts From dev-manager-desktop with Apache License 2.0 | 5 votes |
constructor(
@Host() public parent: AppsComponent,
private appsRepo: AppsRepoService
) { }
Example #13
Source File: tile-grid-item.directive.ts From flingo with MIT License | 5 votes |
constructor(@Host() private tileGrid: TileGridDirective, private elRef: ElementRef) {}
Example #14
Source File: pager-items-comp.ts From nativescript-plugins with Apache License 2.0 | 5 votes |
constructor(
private templateRef: TemplateRef<any>,
@Inject(TEMPLATED_ITEMS_COMPONENT)
@Host()
private comp: TemplatedItemsComponent
) { }
Example #15
Source File: pager-items-comp.ts From nativescript-plugins with Apache License 2.0 | 5 votes |
constructor(
private templateRef: TemplateRef<any>,
@Inject(TEMPLATED_ITEMS_COMPONENT)
@Host()
private owner: TemplatedItemsComponent,
private viewContainer: ViewContainerRef
) { }
Example #16
Source File: index.ts From nativescript-plugins with Apache License 2.0 | 5 votes |
constructor(
private templateRef: TemplateRef<any>,
@Inject(ACCORDION_ITEMS_COMPONENT) @Host() private comp: AccordionItemsComponent) {
}
Example #17
Source File: matx-side-nav-toggle.directive.ts From matx-angular with MIT License | 5 votes |
constructor(
private mediaObserver: MediaObserver,
@Host() @Self() @Optional() public sideNav: MatSidenav
) {
}
Example #18
Source File: channel.component.ts From dev-manager-desktop with Apache License 2.0 | 5 votes |
constructor(
@Host() public parent: AppsComponent,
private appsRepo: AppsRepoService) {
}
Example #19
Source File: plasmic-root-provider.component.ts From plasmic with MIT License | 5 votes |
constructor(@Host() private plasmicLoaderService: PlasmicLoaderService) {}
Example #20
Source File: pager-items-comp.ts From ui-pager with Apache License 2.0 | 5 votes |
constructor(
private templateRef: TemplateRef<any>,
@Inject(TEMPLATED_ITEMS_COMPONENT)
@Host()
private comp: TemplatedItemsComponent
) {}
Example #21
Source File: pager-items-comp.ts From ui-pager with Apache License 2.0 | 5 votes |
constructor(
private templateRef: TemplateRef<any>,
@Inject(TEMPLATED_ITEMS_COMPONENT)
@Host()
private owner: TemplatedItemsComponent,
private viewContainer: ViewContainerRef
) {}
Example #22
Source File: track-by-property.directive.ts From ng-ant-admin with MIT License | 5 votes |
public constructor(@Host() @Optional() private readonly _ngFor: NgForOf<any>, @Host() @Optional() private readonly _cdkFor: CdkVirtualForOf<any>) {
if(this._ngFor){
this._ngFor.ngForTrackBy = (_: number, item: any) => this._propertyName ? item[this._propertyName] : item;
}
if(this._cdkFor){
this._cdkFor.cdkVirtualForTrackBy = (_: number, item: any) => this._propertyName ? item[this._propertyName] : item;
}
}
Example #23
Source File: sticky-header.component.ts From geonetwork-ui with GNU General Public License v2.0 | 5 votes |
constructor(
private changeDetector: ChangeDetectorRef,
@Host() private hostEl: ElementRef,
private zone: NgZone
) {}
Example #24
Source File: search-state.container.directive.ts From geonetwork-ui with GNU General Public License v2.0 | 5 votes |
constructor(@Host() private facade: SearchFacade) {}
Example #25
Source File: search-router.container.directive.ts From geonetwork-ui with GNU General Public License v2.0 | 5 votes |
constructor(@Host() private facade: SearchFacade) {}
Example #26
Source File: table-scroll.directive.ts From alauda-ui with MIT License | 5 votes |
constructor(
private readonly el: ElementRef<HTMLElement>,
@Host() private readonly table: TableComponent<unknown>,
) {}
Example #27
Source File: select.directive.ts From canopy with Apache License 2.0 | 5 votes |
constructor(
@Self() @Optional() public control: NgControl,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
public controlContainer: FormGroupDirective,
) {}
Example #28
Source File: input.directive.ts From canopy with Apache License 2.0 | 5 votes |
constructor(
@Self() @Optional() public control: NgControl,
private errorState: LgErrorStateMatcher,
@Optional()
@Host()
@SkipSelf()
private controlContainer: FormGroupDirective,
) {}
Example #29
Source File: date-field.component.ts From canopy with Apache License 2.0 | 5 votes |
constructor(
private domService: LgDomService,
private errorState: LgErrorStateMatcher,
@Self()
@Optional()
private ngControl: NgControl,
@Optional()
@Host()
@SkipSelf()
private parentFormGroupDirective: FormGroupDirective,
) {
if (this.ngControl != null) {
this.ngControl.valueAccessor = this;
}
this.date = new FormControl(null, [
Validators.required,
Validators.pattern(/^\d{1,2}$/),
Validators.min(1),
Validators.max(31),
]);
this.month = new FormControl(null, [
Validators.required,
Validators.pattern(/^\d{1,2}$/),
Validators.min(1),
Validators.max(12),
]);
this.year = new FormControl(null, [
Validators.required,
Validators.pattern(/^\d\d\d\d$/),
]);
this.dateFormGroup = new FormGroup(
{
date: this.date,
month: this.month,
year: this.year,
},
{
updateOn: 'blur',
},
);
}