Sitemap
Vetriselvan Panneerselvam

Vetriselvan Panneerselvam

Frontend dev who clicks 'Inspect Element' for fun. Freelancing, experimenting, and oversharing my discoveries

Press enter or click to view image in full size
🔍 `@Attribute` Decorator in Angular — A Hidden Gem You Should Know

Member-only story

@Attribute Decorator in Angular — A Hidden Gem You Should Know 🔍

--

Hey developers 👋,

The other day during a casual team discussion, we stumbled upon something interesting while diving deep into Angular’s decorator system. Amid the usual suspects like `@Input`, `@Output`, and `@Inject`, we rediscovered a lesser-used but powerful decorator — `@Attribute`.

I hadn’t paid much attention to this one before, so I decided to explore it further. And now I’m here to share my findings with all of you!

🚀 A shiny new technique just dropped to handle this like a pro.
Curious? Click the link below and geek out with us:
👉 [Check it out here!]

🧠 What Is `@Attribute()`?

The `@Attribute()` decorator is a parameter decorator used inside a directive or component constructor. It tells Angular to **inject a static attribute value** from the host HTML element **as a constant string literal** at construction time.

In simple terms:

> `@Attribute()` lets your directive or component **access raw HTML attribute values** directly — even if they aren’t bound with Angular syntax.

This is especially useful when you need **static metadata** at initialization that won’t change.

--

--

I'm Vetri, a full-stack developer and technical writer with 8+ years of experience. I share practical tutorials, real-world implementation patterns.

See more from me