What is a decorator in Angular 2?

devquora
devquora

Posted On: Feb 22, 2018

 

Decorators are functions that are invoked with a prefixed @ symbol and immediately succeeded by a class, parameter, method or property. The decorator function is supplied data about the class, parameter or method, and the decorator function returns something in its place or manipulates its target in some way. Usually, the "something" a decorator returns is the same thing that was passed in, but it has been augmented in some way.

Decorators are designed for a future version of JavaScript, but the Angular team wanted to use them, and they have been included in TypeScript.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Angular 2 Interview Questions

    What is Angular 2 ?

    Angular 2 is a completely revived component-based framework in which an application is a tree of loosely coupled compon..

    Angular 2 Interview Questions

    List some advantages of Angular 2 over Angular1.

    Angular 2 is a re-written version of Angular1 and not an update. The best way to compare Angular 2 and Angular 1 is by f..

    Angular 2 Interview Questions

    What are the new features of Angular 2?

    Angular 2 is a platform that encompasses a wide range of capabilities. Some new features were added in Angular 2 which i..