Answers for "angular directive"

1

angular directive output

// just use it normal
@Output() itch:EventEmitter<any> = new EventEmitter();

//and call in html
<div appCollar (itch)='scratch()' >
Posted by: Guest on August-13-2020
3

angular directive

//generate Angular Directives
ng generate directive highlight

//it will generate the following component
import { Directive, ElementRef } from '@angular/core';

@Directive({
  selector: '[appHighlight]'
})
export class HighlightDirective {
    constructor(el: ElementRef) {
       el.nativeElement.style.backgroundColor = 'yellow';
    }
}
// you can use the directive in the template as:
<p appHighlight> highlighted text </p>
Posted by: Guest on February-10-2021
1

angular directive

content_copy
      
      <p app:Highlight>This is invalid</p>
Posted by: Guest on March-28-2021
0

user defined directives in angular 7

import { Directive, ElementRef } from '@angular/core';
Posted by: Guest on October-08-2020
0

directives in angular

content_copy
      
      <!-- toggle the "special" class on/off with a property -->
<div [ngClass]="isSpecial ? 'special' : ''">This div is special</div>
Posted by: Guest on September-30-2021
0

user defined directives in angular 7

<p [ngStyle]="{`THE CSS YOPU WANT TO ADD`}"> I am an Attribute Directive</p>
Posted by: Guest on October-08-2020

Code answers related to "angular directive"

Code answers related to "Javascript"

Browse Popular Code Answers by Language