@angular/core#QueryList TypeScript Examples
The following examples show how to use
@angular/core#QueryList.
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: ngx-splide.component.ts From ngx-splide with MIT License | 6 votes |
ngAfterViewInit()
{
if (!isPlatformBrowser(this.platformId))
return;
this.splide = new Splide(this.splideElement.nativeElement, this.options);
if (this.syncWith) {
this.splide.sync(this.syncWith.getSplideInstance());
}
this.onInit.emit(this.splide);
this.addEventListeners();
this.splide.mount();
const slidesSubscription = this.slides.changes
.subscribe((list: QueryList<NgxSplideSlideComponent>) => {
this.cdr.detectChanges();
setTimeout(() => {
this.splide.destroy();
this.splide.mount();
this.addEventListeners();
});
})
;
this.cdr.detectChanges();
}
Example #2
Source File: anchor.directive.ts From alauda-ui with MIT License | 6 votes |
ngAfterContentInit() {
const containerEl = this.containerEl;
this.anchorPortal = new ComponentPortal(AnchorComponent);
const portalOutlet = new DomPortalOutlet(
document.body,
this.cfr,
this.appRef,
this.injector,
);
const anchorComponentRef = this.anchorPortal.attach(portalOutlet);
const anchorEl = anchorComponentRef.injector.get(ElementRef)
.nativeElement as HTMLElement;
requestAnimationFrame(() =>
this.adaptAnchorPosition(containerEl, anchorEl),
);
this.anchorLabels.changes
.pipe(startWith(this.anchorLabels), takeUntil(this.destroy$$))
.subscribe((anchorLabels: QueryList<AnchorLabelDirective>) => {
Object.assign(anchorComponentRef.instance, {
items: anchorLabels.toArray(),
});
});
}
Example #3
Source File: dxc-tabs.component.ts From halstack-angular with Apache License 2.0 | 6 votes |
public ngAfterViewInit() {
this.generateTabs();
this.className = `${this.getDynamicStyle(this.defaultInputs.getValue())}`;
this.insertUnderline();
this.cdRef.detectChanges();
this.setEventListeners();
this.cdRef.detectChanges();
this.tabs.changes.subscribe((value) => {
const matTabsFromQueryList = value.map((tab, index) => {
if (tab.label && tab.iconSrc) {
this.allTabWithLabelAndIcon = true;
}
tab.id = index;
return tab.matTab;
});
const list = new QueryList<MatTab>();
list.reset([matTabsFromQueryList]);
this.tabGroup._tabs = list;
this.setActiveTab();
this.cdRef.detectChanges();
});
}
Example #4
Source File: dashboard.component.ts From EDA with GNU Affero General Public License v3.0 | 6 votes |
/* Set applyToAllFilters for new panel when it's created */
public ngAfterViewInit(): void {
this.edaPanelsSubscription = this.edaPanels.changes.subscribe((comps: QueryList<EdaBlankPanelComponent>) => {
const globalFilters = this.filtersList.filter(filter => filter.isGlobal === true);
const unsetPanels = this.edaPanels.filter(panel => panel.panel.content === undefined);
setTimeout(() => {
unsetPanels.forEach(panel => {
globalFilters.forEach(filter => {
filter.panelList.push(panel.panel.id);
panel.setGlobalFilter(this.formatFilter(filter))
});
});
}, 0);
});
}
Example #5
Source File: layout.component.ts From open-source with MIT License | 6 votes |
private loadIndex(): void {
this.http.get('/static/docs.json').subscribe((routes: DocsIndex) => {
this.initNav(routes);
// open the panel corresponding to the currentUrl
this.panels.changes.subscribe((panels: QueryList<MatExpansionPanel>) => {
panels.map((panel, i) => {
const el = this.elements.get(i);
const attr = el.nativeElement.getAttribute('route');
if (`/${this.currentUrl}`.includes(attr)) {
panel.open();
}
});
});
// wait until the nav is loaded to load the page
this.nav.pipe(
filter(nav => Boolean(nav.length)),
switchMap(() => this.route.url),
).subscribe((segments) => {
// search the requested URL in the index
this.currentUrl = segments.map(({ path }) => path).join('/');
this.metadata = routes[`/${this.currentUrl}`];
if (!this.metadata) {
if (this.response) {
this.response.statusCode = 404;
this.response.statusMessage = 'Page Not Found';
}
this.router.navigateByUrl('/404');
} else if (this.metadata?.redirectTo) {
this.router.navigateByUrl(this.metadata.redirectTo);
}
});
});
}
Example #6
Source File: rubic-language-select.component.ts From rubic-app with GNU General Public License v3.0 | 5 votes |
@ViewChildren('dropdownOptionTemplate') dropdownOptionsTemplates: QueryList<TemplateRef<unknown>>;
Example #7
Source File: query.component.ts From dbm with Apache License 2.0 | 5 votes |
@ViewChildren('codeEditors')
private codeEditors: QueryList<ElementRef>;
Example #8
Source File: result-table.component.ts From Bridge with GNU General Public License v3.0 | 5 votes |
@ViewChildren('tableRow') tableRows: QueryList<ResultTableRowComponent>
Example #9
Source File: ngx-splide.component.ts From ngx-splide with MIT License | 5 votes |
@ContentChildren(NgxSplideSlideComponent) public slides: QueryList<NgxSplideSlideComponent>;
Example #10
Source File: accordion.component.ts From canopy with Apache License 2.0 | 5 votes |
@ContentChildren(forwardRef(() => LgAccordionPanelHeadingComponent), {
descendants: true,
})
panelHeadings: QueryList<LgAccordionPanelHeadingComponent>;
Example #11
Source File: integration-bar.component.ts From leapp with Mozilla Public License 2.0 | 5 votes |
@ViewChildren(MatMenuTrigger)
triggers: QueryList<MatMenuTrigger>;
Example #12
Source File: the-amazing-list.component.ts From Angular-Cookbook with MIT License | 5 votes |
@ViewChildren(TheAmazingListItemComponent)
listItemsElements: QueryList<TheAmazingListItemComponent>;
Example #13
Source File: component.ts From pantry_party with Apache License 2.0 | 5 votes |
@ContentChildren(FormErrorTextComponent) errorMessages!: QueryList<FormErrorTextComponent>;
Example #14
Source File: chat.component.ts From qd-messages-ts with GNU Affero General Public License v3.0 | 5 votes |
@ContentChildren(NbChatMessageComponent) messages: QueryList<NbChatMessageComponent>;
Example #15
Source File: select.component.ts From ng-event-plugins with Apache License 2.0 | 5 votes |
@ViewChildren('option')
private readonly options!: QueryList<ElementRef>;
Example #16
Source File: timeline.component.ts From VIR with MIT License | 5 votes |
// @ts-ignore
@ViewChildren('monthDayView') monthDayViews: QueryList<MonthDayViewComponent>
Example #17
Source File: board.component.ts From worktez with MIT License | 5 votes |
@ViewChildren(FeatureCardComponent) child: QueryList<FeatureCardComponent>;
Example #18
Source File: overflow-carousel.component.ts From nghacks with MIT License | 5 votes |
@ViewChildren(ResizedDirective) private _resizedDirectives: QueryList<ResizedDirective>;
Example #19
Source File: anchor.directive.ts From alauda-ui with MIT License | 5 votes |
@ContentChildren(AnchorLabelDirective, { descendants: true })
anchorLabels: QueryList<AnchorLabelDirective>;
Example #20
Source File: link-active.directive.ts From router with MIT License | 5 votes |
@ContentChildren(LinkTo, { descendants: true })
public links: QueryList<LinkTo>;
Example #21
Source File: layout.component.ts From budget-angular with GNU General Public License v3.0 | 5 votes |
@ViewChildren(MenuItemDirective)
private buttons: QueryList<MenuItemDirective>;
Example #22
Source File: collection-view.component.ts From attack-workbench-frontend with Apache License 2.0 | 5 votes |
@ViewChildren(StixListComponent) stixLists: QueryList<StixListComponent>;
Example #23
Source File: json-schema-form.component.ts From json-schema-form with Apache License 2.0 | 5 votes |
/**
* container children for event propagation
*/
@ViewChildren('children') children: QueryList<JsonSchemaFormComponent>;
Example #24
Source File: dxc-accordion.component.ts From halstack-angular with Apache License 2.0 | 5 votes |
/**
* Element used as the icon that will be placed next to panel label.
*/
@ContentChildren(DxcAccordionIconComponent)
dxcAccordionIcon: QueryList<DxcAccordionIconComponent>;