Decorators are actually just functions that are called as per the component they are handling. A class decorator shall be called with the class being decorated and similarly for a method decorator. Here’s how to create a decorator in Angular 6:

BY Best Interview Question ON 16 Feb 2020

Example

Step 1:
function Console(target) {
    console.log('Our decorated class', target);
}

Step 2:
@Console
class ExampleClass {
    constructor() {
        console.log('Hello!');
    }
}