angular viewchild set attribute
// If you call console.log on one of the button elements, you can see that it is an instance of ElementRef, not HTMLElement.
// So...
// Import ElementRef from @angular/core:
import {Component, ViewChild, ElementRef} from '@angular/core';
// Change the buttons type from HTMLElement to ElementRef:
@ViewChild('roundButtonOne') roundButtonOne: ElementRef;
@ViewChild('roundButtonTwo') roundButtonTwo: ElementRef;
@ViewChild('roundButtonThree') roundButtonThree: ElementRef;
// Get nativeElement from ElementRef object and then call setAttribute() / getAttribute() methods:
this.roundButtonOne.nativeElement.getAttribute('xlink:href');
this.roundButtonOne.nativeElement.setAttribute('xlink:href','#mic-small');
Also in JavaScript:
- visual studio appsettings development json not nested appsettings.json
- is react context better than redux
- angular redirect to external url
- remove a user from a reaction discord.js
- node js how to basic auth to specific urk
- some in javascript
- angular copy
- mysql json array contains
- js find key by value in object
- js local storage delete key
- random int between two numbers javascript
- format a date moment
- SFC in react
- nodejs shebang
- javascript function required arguments
- bracket notation javascript
- cypress memory leak
- angular material chips
- javascript even number
- split string into char array javascript
- index.js:1 Warning: validateDOMNesting(...): <a> cannot appear as a descendant of <a>.
- javascript multiple startswith
- how to convert whole strig in lowercase in js
- get height of div use js