title: use of this in constructor in refrence with dependencies injection in angular
body: <p>I was checking Angular Official documents and other blogs and see 2 different kinds of syntax for DI when using within the constructor, sometimes they use <code>this</code> and sometimes no use of <code>this</code>. which one is correct?</p>
  
  <p>I know we need to use <code>this</code> in any other method of the class but why we do not use <code>this</code> in the constructor. or just <code>private</code> and <code>public</code> identifier makes the difference to use of <code>this</code></p>
  
  <pre><code>import { Component } from '@angular/core';
  
  
  class NameService {
    getName () {
      return "Angular";
    }
  }
  
  @Component({
    selector: 'my-app',
    template: '&lt;h1&gt;Favourite framework: {{ name }}&lt;/h1&gt;'
  })
  class AppComponent {
    name: string;
  
    constructor(nameService: NameService) {
      this.name = nameService.getName(); // do not use this
  
    }
  
    otherMethod() {
      this.nameService.getName(); // use this
    }
  }
  </code></pre>
  
  <p>somewhere I have seen people using this within the constructor. here one of <a href="https://angular.io/guide/dependency-injection#optional-dependencies" rel="nofollow noreferrer">the example</a></p>
  
  <pre><code>constructor(@Optional() private logger: Logger) {
    if (this.logger) {
      this.logger.log(some_message); // using this
    }
  }
  </code></pre>
  
  <p>so when do we use this and when not? or we are using this in later example because of <code>@Optional</code> decorators?</p>