Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

addclass to elementref angular

export class CustomDirective {

   constructor(private renderer: Renderer2,
               private elementRef: ElementRef,
               service: SomService) {
   }

   addClass(className: string, element: any) {
       this.renderer.addClass(element, className);
       // or use the host element directly
       // this.renderer.addClass(this.elementRef.nativeElement, className);
   }

   removeClass(className: string, element: any) {
       this.renderer.removeClass(element, className);
   }

}
Comment

PREVIOUS NEXT
Code Example
Javascript :: JS ignoring accents 
Javascript :: create react portal 
Javascript :: js get last element of an array 
Javascript :: multiple line string in jquery 
Javascript :: update array of object using other array javascript 
Javascript :: how to limit input type max length 
Javascript :: how to put text in the center react native 
Javascript :: activeclassname in react router v6 
Javascript :: react native image blur 
Javascript :: javascript extract number from string 
Javascript :: Fibonacci Series Program. in javascript 
Javascript :: return only specific attributes when making query mongoose 
Javascript :: how to append the dropdown values by jquery each function 
Javascript :: for range python javascript 
Javascript :: javascript xor 
Javascript :: jquery today date 
Javascript :: zoho smtp mail nodejs 
Javascript :: moment time ago format reactjs 
Javascript :: jquery get select name value 
Javascript :: unshift 
Javascript :: pwa angular npm 
Javascript :: heroku scripts 
Javascript :: teste 
Javascript :: create an array of numbers 
Javascript :: print page in javascript 
Javascript :: substring javascript 
Javascript :: js remove the last character from a string 
Javascript :: restfull api methods 
Javascript :: return response json two variables laravel 
Javascript :: angular http put 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =