Search
 
SCRIPT & CODE EXAMPLE
 

CSS

how to add css using nativeelement in angular

import { ..., AfterViewInit, ElementRef, ViewChild, Renderer2, ... } from '@angular/core';
...
export class AdvertisementDirective implements AfterViewInit {

  @ViewChild('templateRefName') el: ElementRef;

  constructor(
    private renderer: Renderer2
  ) {
  }

  ngAfterViewInit() {
    this.renderer.setStyle(this.el.nativeElement, 'background', 'yellow');
    this.renderer.setProperty(this.el.nativeElement, 'innerHTML', '<p>Hello World<p>');
  }

}
Comment

PREVIOUS NEXT
Code Example
Css :: how to select classes that start with a certian name 
Css :: css profile picture round 
Css :: email background image 
Css :: rotate keyfreame animation 
Css :: object-position 
Css :: line-weight css 
Css :: import tailwind 
Css :: table data max width 
Css :: how to use image zoom effect in css 
Css :: how to create multicolor text in css 
Css :: hide page scrollbar css 
Css :: media queries 
Css :: outline bottom css 
Css :: easy ways to implement dark mode html css 
Css :: how hide in html 
Css :: css custom bullet list 
Css :: pure css tabs 
Css :: setting multiple css using dom 
Css :: add drop shadow css 
Css :: how to horizontally center header at the top of page with flexbox css 
Css :: cool gradient 
Css :: make previous commit master 
Css :: how to center icon vertically in react js 
Css :: css background image not working 
Css :: CSS Text Shadow Effect( cool) 
Css :: change text color when scrolling css 
Css :: css clear 
Css :: css varianbes 
Css :: change button shaddow css 
Css :: css if select has value 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =