In an Angular2 Component, when doing:
console.log (this);
you get as expected the whole object with all members, e.g.
"ComponentName {member1, member2, member_n}"
Now I want to only log the ComponentName. How to achieve?
Really interesting question, this is what you are looking for:
console.log(this.constructor.name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With