@angular/core#Renderer2 TypeScript Examples
The following examples show how to use
@angular/core#Renderer2.
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: layout-utils.ts From ng-devui-admin with MIT License | 7 votes |
export function setScreenPointFlex(point: DaBreakpoint, context: any, elementRef: ElementRef, renderer: Renderer2): void {
let flexName;
let flex;
for (const tempPoint of DaBreakpoints) {
flexName = 'daFlex' + firstLetterToUpperCase(tempPoint);
flex = context[flexName] !== undefined ? context[flexName] : flex;
if (tempPoint === point) {
flex = flex === undefined ? context['daFlex'] : flex;
break;
}
}
renderer.setStyle(elementRef.nativeElement, 'flex', parseFlex(flex));
}
Example #2
Source File: service-map.page.ts From Uber-ServeMe-System with MIT License | 6 votes |
constructor(
public toastCtrl: ToastController,
private platform: Platform,
private loadingCtrl: LoadingController,
// private ngZone: NgZone,
public route: Router,
public activatedRoute: ActivatedRoute,
public nav: NavController,
private elementRef: ElementRef,
private renderer: Renderer2,
public modalCtrl: ModalController,
public firestore: AngularFirestore,
public navCtrl: NavController,
// private dataService: DataService,
) {
// console.log('declared var:', google)
// this.activateRoute.queryParams.subscribe((data: any) => {
// console.log("data.service:", data.service)
// this.service = data.service
// console.log("service1:", this.service)
// })
}
Example #3
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 #4
Source File: app.component.ts From xBull-Wallet with GNU Affero General Public License v3.0 | 6 votes |
constructor(
@Inject(ENV)
private readonly env: typeof environment,
private readonly settingsService: SettingsService,
private readonly settingsQuery: SettingsQuery,
private readonly walletsAccountsService: WalletsAccountsService,
private readonly walletsAccountsQuery: WalletsAccountsQuery,
private readonly walletsOperationsQuery: WalletsOperationsQuery,
private readonly alertsLabelsService: AlertsLabelsService,
private readonly horizonApisQuery: HorizonApisQuery,
private readonly route: ActivatedRoute,
@Inject(DOCUMENT)
private readonly document: Document,
private readonly renderer2: Renderer2,
private readonly globalsService: GlobalsService,
private readonly ngZone: NgZone,
private readonly translateService: TranslateService,
) { }
Example #5
Source File: layout-utils.ts From ng-devui-admin with MIT License | 6 votes |
export function setGridClass(context: any, elementRef: ElementRef, renderer: Renderer2): void {
const breakpoints = ['Ms', 'Mm', 'Ml', 'Xs', 'Sm', 'Md', 'Lg', 'Xl'];
const classPrefixMap: any = {
daOffset: 'dl-offset-',
daAlign: 'dl-align-items-',
daJustify: 'dl-justify-content-',
daAlignSelf: 'dl-align-self-',
daOrder: 'dl-order-',
};
const tempClassMap: any = {};
if (context.daSpan !== undefined) {
const className = context.daSpan === 0 ? `dl-d-none` : `dl-col-${context.daSpan}`;
tempClassMap[className] = true;
}
breakpoints.forEach((point) => {
const sizeName = 'da' + point;
point = point.toLowerCase();
if (context[sizeName] !== undefined) {
if (typeof context[sizeName] === 'number') {
const className = context[sizeName] === 0 ? `dl-d-${point}-none` : `dl-col-${point}-${context[sizeName]}`;
tempClassMap[className] = true;
} else {
const mergedProperty: any = context[sizeName] as DaMergedProperty;
if (mergedProperty.hasOwnProperty('span')) {
const className = mergedProperty['span'] === 0 ? `dl-d-${point}-none` : `dl-col-${point}-${mergedProperty['span']}`;
tempClassMap[className] = true;
}
for (const prefix in classPrefixMap) {
if (mergedProperty.hasOwnProperty(prefix.slice(2).toLowerCase())) {
const className = classPrefixMap[prefix] + mergedProperty[prefix.slice(2).toLowerCase()];
tempClassMap[className] = true;
}
}
}
}
});
for (const prefix in classPrefixMap) {
if (context[prefix] !== undefined) {
const className = classPrefixMap[prefix] + context[prefix];
tempClassMap[className] = true;
}
breakpoints.forEach((point) => {
const name = prefix + point;
point = point.toLowerCase();
if (context[name] !== undefined) {
const className = classPrefixMap[prefix] + `${point}-${context[name]}`;
tempClassMap[className] = true;
}
});
}
if (context.classMap) {
for (const className in context.classMap) {
if (context.classMap.hasOwnProperty(className)) {
renderer.removeClass(elementRef.nativeElement, className);
}
}
}
context.classMap = { ...tempClassMap };
for (const className in context.classMap) {
if (context.classMap.hasOwnProperty(className) && context.classMap[className]) {
renderer.addClass(elementRef.nativeElement, className);
}
}
}
Example #6
Source File: brand-icon.component.ts From canopy with Apache License 2.0 | 6 votes |
constructor(
private iconRegistry: LgBrandIconRegistry,
@Inject(DOCUMENT) private document: any,
private renderer: Renderer2,
private hostElement: ElementRef,
) {
this.renderer.addClass(
this.hostElement.nativeElement,
`lg-brand-icon--${this._size}`,
);
}
Example #7
Source File: ion-media-cache.directive.ts From ion-media-cache with MIT License | 6 votes |
constructor(
private el: ElementRef,
private file: File,
private renderer: Renderer2,
private platform: Platform,
private webview: WebView) {
this.tag = this.el;
if (!window['IonMediaCache']) {
window['IonMediaCache'] = {};
}
if (this.isMobile) {
fromEvent(document, 'deviceready').pipe(first()).subscribe(res => {
this.initCache();
});
} else {
this.initCache();
}
}
Example #8
Source File: emote-list.component.ts From App with MIT License | 6 votes |
constructor(
private restService: RestService,
private renderer: Renderer2,
private router: Router,
private route: ActivatedRoute,
private appService: AppService,
private dataService: DataService,
public themingService: ThemingService
) { }
Example #9
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 #10
Source File: link-active.directive.ts From router with MIT License | 6 votes |
constructor(
public element: ElementRef,
public router: Router,
public renderer: Renderer2,
@Optional()
@Inject(LINK_ACTIVE_OPTIONS)
private defaultActiveOptions: LinkActiveOptions,
@Optional() private link: LinkTo
) {}
Example #11
Source File: app.component.ts From blockcore-explorer with MIT License | 6 votes |
constructor(
private api: ApiService,
private setup: SetupService,
private theme: ThemeService,
private router: Router,
private renderer: Renderer2,
private activatedRoute: ActivatedRoute) {
this.theme.init(renderer);
}
Example #12
Source File: np-blockui.directive.ts From np-ui-lib with MIT License | 6 votes |
constructor(private elRef: ElementRef, private renderer: Renderer2) {
const icon = `<svg class="np-icon" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>
</svg>`;
const blockUi = this.renderer.createElement("div");
this.renderer.addClass(blockUi, "np-blockui");
blockUi.innerHTML = icon;
this.element = this.renderer.createElement("div");
this.renderer.addClass(this.element, "np-blockui-backdrop");
this.renderer.appendChild(this.element, blockUi);
}
Example #13
Source File: chat-bottom-bar.component.ts From onchat-web with Apache License 2.0 | 6 votes |
constructor(
public globalData: GlobalData,
public elementRef: ElementRef<HTMLElement>,
private socket: Socket,
private overlay: Overlay,
private renderer: Renderer2,
private platform: Platform,
private injector: Injector,
private destroyer: Destroyer,
) { }
Example #14
Source File: search.component.ts From open-genes-frontend with Mozilla Public License 2.0 | 6 votes |
constructor(
private renderer: Renderer2,
private apiService: ApiService,
private settingsService: SettingsService,
private cdRef: ChangeDetectorRef
) {
super();
this.searchForm = new FormGroup({
searchField: new FormControl(''),
});
}
Example #15
Source File: appendNewEntries.component.ts From data-annotator-for-machine-learning with Apache License 2.0 | 6 votes |
constructor(
private route: ActivatedRoute,
private avaService: AvaService,
private userAuthService: UserAuthService,
private formBuilder: FormBuilder,
private router: Router,
private el: ElementRef,
private renderer2: Renderer2,
private UnZipService: UnZipService,
public env: EnvironmentsService,
private toolService: ToolService,
private s3Service: S3Service,
) {
this.user = this.userAuthService.loggedUser().email;
this.route.queryParams.subscribe((params) => {
this.projectId = params['id'];
this.projectName = params['name'];
this.routeFrom = params['from'];
this.projectType = params['projectType'];
this.categoryList = params['categoryList'];
this.regression = params['regression'];
});
this.userQuestionUpdate.pipe(debounceTime(400), distinctUntilChanged()).subscribe((value) => {
if (value != '') {
this.checkName(value);
} else {
this.nameExist = false;
}
});
}
Example #16
Source File: expandable-header.directive.ts From Uber-ServeMe-System with MIT License | 5 votes |
constructor(private element: ElementRef, private renderer: Renderer2, private domCtrl: DomController) {
}
Example #17
Source File: clipboard.service.ts From xBull-Wallet with GNU Affero General Public License v3.0 | 5 votes |
private renderer: Renderer2;
Example #18
Source File: banner.directive.ts From rubic-app with GNU General Public License v3.0 | 5 votes |
constructor(private elementRef: ElementRef, private renderer: Renderer2) {
renderer.addClass(elementRef.nativeElement, 'banner');
}
Example #19
Source File: navbar.component.ts From ng-devui-admin with MIT License | 5 votes |
constructor(private elementRef: ElementRef, private router: Router, private renderer: Renderer2) {
this.currentUrl = this.router.url;
}
Example #20
Source File: alert.component.ts From canopy with Apache License 2.0 | 5 votes |
constructor(private renderer: Renderer2, private hostElement: ElementRef) {
this.variant = 'generic';
}
Example #21
Source File: componentCreator.ts From ngx-dynamic-hooks with MIT License | 5 votes |
private renderer: Renderer2;
Example #22
Source File: popover-positional-class.directive.ts From Angular-Cookbook with MIT License | 5 votes |
constructor(private renderer: Renderer2, private cdRef: ChangeDetectorRef) {}
Example #23
Source File: ngx-gallery-helper.service.ts From ngx-gallery-9 with MIT License | 5 votes |
constructor(private renderer: Renderer2) {}
Example #24
Source File: aem-component.directive.ts From aem-angular-editable-components with Apache License 2.0 | 5 votes |
constructor(
private renderer: Renderer2,
private viewContainer: ViewContainerRef,
private compiler: Compiler,
private injector: Injector,
private factoryResolver: ComponentFactoryResolver,
private _changeDetectorRef: ChangeDetectorRef) {
}
Example #25
Source File: multi-select.component.ts From alauda-ui with MIT License | 5 votes |
constructor(cdr: ChangeDetectorRef, private readonly renderer: Renderer2) {
super(cdr);
}
Example #26
Source File: dropdown.directive.ts From t3mpl-editor with MIT License | 5 votes |
public constructor(
private readonly el: ElementRef<HTMLElement>,
private readonly renderer: Renderer2) {
}
Example #27
Source File: theme.service.ts From blockcore-explorer with MIT License | 5 votes |
public init(renderer: Renderer2) {
this.renderer = renderer;
this.updateMode();
}
Example #28
Source File: help-page.component.ts From attack-workbench-frontend with Apache License 2.0 | 5 votes |
constructor(private markdownService: MarkdownService,
private router: Router,
private renderer: Renderer2,
public route: ActivatedRoute,
private viewportScroller: ViewportScroller) {}
Example #29
Source File: cloudflare-stream.component.ts From stream-angular with BSD 3-Clause "New" or "Revised" License | 5 votes |
constructor(
private renderer2: Renderer2,
@Inject(DocumentWrapper) private doc: DocumentWrapper,
@Inject(PLATFORM_ID) private platformId: any
) {}