From the course: Angular: Testing and Debugging

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understanding Angular decorators

Understanding Angular decorators - Angular Tutorial

From the course: Angular: Testing and Debugging

Start my 1-month free trial

Understanding Angular decorators

- [Instructor] Decorators are functions that return functions. That simple. But in Angular, they supply metadata about a particular class or property or value. And they also help with dependency injection across the entire app. They are built in from the ground up as part of the Angular framework. Decorators are marked by placing an @ symbol in front of the Decorator name. They are invoked at runtime and expect arguments to be passed in either between the parentheses or immediately after the closing parentheses of the Decorator. This is why semi-colons are left off the end of the Decorator expression and why parentheses, even empty ones, always follow the name of the Decorator. Common decorators are NGModule to define the modules, Component to define components, Injectable to define services, and Input and Output to define properties that are sent and received from the DOM. There are many built-in Decorators available in Angular and many properties on each Decorator. So I recommend…

Contents