title: Reference to the instance of the decorated class being invoked in Angular
body: <p>I have a decorated class like this.</p>
  
  <pre><code>@BlingBling
  @Component({ ... })
  export class Classico implements OnInit {
    processId: string;
  }
  </code></pre>
  
  <p>The decorator is implemented like this.</p>
  
  <pre><code>export function BlingBling(ctor: Function) {
    console.log("Wheheee");
    console.log(ctor);
    console.log(this);
  }
  </code></pre>
  
  <p>I can see that I can <strong>see</strong> the constructor (and probably invoke it too) but I haven't succeeded accessing the instance of the class being created. I tried <em>this</em> but it's <em>undefined</em>. Have no more ideas and googling produced nothing I recognized as useful.</p>
  
  <p>I'd like to push in a value to the <em>processId</em> field from the decorator (logging purposes). I can imagine doing that from the constructor but that seems like creating a dependency that I don't want to create.</p>
  
  <p><strong>edit</strong>
  I've found <a href="https://ultimatecourses.com/blog/angular-decorators#passing-data-to-a-decorator" rel="nofollow noreferrer">this blog</a> where the author suggests the syntax below to achieve it but I'm not sure if it's correct approach since he's abandoning the syntax where the constructor is being passed in to the decorator code.</p>
  
  <pre><code>function Console(message) {
    console.log(message);
    return function(target) {
      console.log('Our decorated class', target);
    };
  }
  
  @Console('Hey!')
  class ExampleClass {
    constructor() {
      console.log('Yo!');
    }
  }
  </code></pre>
  
  <p>I also feel confused if it's the class that we handle then or an instance of a class. Have we overriden the original constructor by that? </p>