Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

@viewchild in angular :use for take any refrerence of element

//html code:
<h2>Choose Brand Colors:</h2>
<color-sample
  [color]="primary"
  #primaryColorSample
  (click)="open()">
</color-sample>
  ... the rest of the AppComponent template
  //ts file:
  
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html'
})
export class AppComponent implements  AfterViewInit {
   ....
   
  @ViewChild('primaryColorSample', {read: ElementRef})
  sample: ElementRef;

  ngAfterViewInit() {
    console.log('Values on ngAfterViewInit():');
    console.log("sample:", this.sample.nativeElement);
  }

  ....
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to give args type in nestjs graphql for array of input 
Javascript :: angular add ellipsis to template string 
Javascript :: javascript getter arrow function 
Javascript :: search node in tree javascript 
Javascript :: get last element in array javascript 
Javascript :: puppeteer stealth popup 
Javascript :: replace specific values in array 
Javascript :: js export options 
Javascript :: angular material button color 
Javascript :: how to make a vertical array js 
Javascript :: JavaScript Nested Function 
Javascript :: ajax call to load a page on scrolling 
Javascript :: multi filtering react 
Javascript :: add another column without delete table sequelize 
Javascript :: angular material moduel 
Javascript :: Merging Or Copying Arrays Using Spread Operator 
Javascript :: logical operators in javascript 
Javascript :: npm: Create react chrome extension 
Javascript :: javascript clear an array 
Javascript :: date match mongodb 
Javascript :: sintax arrow function in javascript 
Javascript :: jsonplaceholder typicode 
Javascript :: get decimals from float javascript 
Javascript :: document.body.style.background 
Javascript :: explode array inside string javascript 
Javascript :: Don’t Use If-Else and Switch in JavaScript, Use Object Literals 
Javascript :: create javascript map 
Javascript :: js Arrays indexOf 
Javascript :: this in ajax call 
Javascript :: prop types in react 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =