title: Using @ViewChild to select an element by Class name?
body: <p>In this article <a href="https://netbasal.com/create-advanced-components-in-angular-e0655df5dde6" rel="nofollow noreferrer">Create Advanced Component</a> the author selects an element by first creating a directive:</p>
  
  <pre><code>@Directive({
    selector: '.tooltip-container'
  })
  export class TooltipContainerDirective {}
  </code></pre>
  
  <p>And then using that directive to select the element containing the class <code>.tooltip-container</code> like this:</p>
  
  <pre><code>    @Component({
      template: `
          &lt;div class="tooltip-container" [ngStyle]="{top: top}"&gt;
          &lt;ng-content&gt;&lt;/ng-content&gt;
          &lt;/div&gt;
      `,
      styles: [...]
      })
      export class TooltipComponent implements OnInit {
      top : string;
      @ViewChild(TooltipContainerDirective, { read: ElementRef }) private tooltipContainer;
  
  
      }
  </code></pre>
  
  <p>Does Angular have the ability to select the <code>tooltipContainer</code> element by class name without using the directive?</p>