Created
May 29, 2019 17:17
-
-
Save andlewis/7192b1d37024cf812417807b261dcf97 to your computer and use it in GitHub Desktop.
Angular - add a ping attribute to every a tag on the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ngAfterViewChecked() { | |
let count = 0; | |
Array.from(document.getElementsByTagName('a')).filter((x: any) => !x.ping).forEach((x: any) => { x.ping = this.metricsUrl; count++ }); | |
if (count > 0) { | |
console.log(`ngAfterViewChecked. ${count} linked updated`); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment