title: How can I select children of an element that has a specific class in Angular directive?
body: <p>How can I select children of an element that has a specific class in Angular directive?</p>
  <p>I am trying to intercept an image download error with the following directive:</p>
  <pre><code>import { Directive, ElementRef } from '@angular/core';
  
  @Directive({
      selector: '.imgs-container img',
      host: {
          '(error)': 'onImgError($event)'
      }
  })
  export class InterceptImgErrorDirective {
      constructor(
          private el: ElementRef
      ) {
          const sotp = 0;
      }
  
      onImgError(arg: any) {
          const stop = 0;
      }
  }
  </code></pre>
  <p>Now in html I have:</p>
  <pre><code>&lt;div class=&quot;imgs-container&quot;&gt;
      &lt;img&gt;
  &lt;/div&gt;
  </code></pre>
  <p>I am expecting my breakpoint to come into the directive's constructor. But the breakpoint is never hit.</p>
  <p>I tried to google and find something on the complex directive selectors, like the one I am using here. And I neither found that it is possible, nor did I find that it is impossible.</p>
  <p>So, could someone advise me on the matter, please? Is it impossible or am I missing something here?</p>
  <p>I am not interested in all the images on my page. I am only interested in the images which are contained in a specific <code>div</code>. So, I can not use just the <code>img</code> selector. Also, I can not apply a specific class to all the images inside the specific element. So, I can not use something like the <code>img.intercept-error-here</code> selector.</p>