angular-renderer

Angular: Use Renderer 2 to Add CSS Variable

故事扮演 提交于 2019-12-01 11:06:20
问题 Is it possible to add inline style css variable using Renderer2 ? I tried the following but it doesn't work. import { Component, OnChanges, Output, ViewChild, Renderer2, ElementRef, ViewEncapsulation } from '@angular/core'; @Component({ }) export class CollapsibleComponent implements OnChanges { @ViewChild('collapsibleContent') collapsibleContent: ElementRef; constructor( private renderer: Renderer2 ) { } ngOnChanges() { this.measureCollapsibleContents() } measureCollapsibleContents() { this