title: Why won't aot compiler error on missing property?
body: <p>With the following code:</p>
  
  <p>template</p>
  
  <pre><code>&lt;button (click)="myMethod()"&gt;myMethod()&lt;/button&gt;
  &lt;!-- &lt;button (click)="foo()"&gt;foo()&lt;/button&gt; --&gt;
  
  &lt;ng-container [ngSwitch]="state"&gt;
    &lt;ng-container *ngSwitchCase="0"&gt;
      &lt;div&gt;&lt;/div&gt;
      &lt;button (click)="myMethod()"&gt;myMethod()&lt;/button&gt;
      &lt;button (click)="foo()"&gt;foo()&lt;/button&gt;&lt;!-- why no error --&gt;
    &lt;/ng-container&gt;
    &lt;div *ngSwitchCase="1"&gt;&lt;/div&gt;
  &lt;/ng-container&gt;
  </code></pre>
  
  <p>component</p>
  
  <pre><code>export class MyComponent {
  
    public state = 0;
  
    public myMethod(): void {
      // no op
    }
  
  }
  </code></pre>
  
  <p><code>ng build --aot</code> builds, but if you uncomment the 2nd line in the template you expectedly get </p>
  
  <blockquote>
    <p>Property 'foo' does not exist on type 'MyComponent'.</p>
  </blockquote>
  
  <p>Why does the <code>&lt;button (click)="foo()"&gt;foo()&lt;/button&gt;</code> inside the <code>ng-container</code> not error?</p>
  
  <p>Before you suggest: </p>
  
  <pre><code>&lt;div *ngSwitchCase="0"&gt;
    &lt;div&gt;&lt;/div&gt;
    &lt;button (click)="myMethod()"&gt;myMethod()&lt;/button&gt;
    &lt;button (click)="foo()"&gt;foo()&lt;/button&gt;&lt;!-- why no error --&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>that will render as </p>
  
  <pre><code>&lt;div&gt;
    &lt;div&gt;&lt;/div&gt;
    &lt;button&gt;myMethod()&lt;/button&gt;
    &lt;button&gt;foo()&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>but I need just </p>
  
  <pre><code>&lt;div&gt;&lt;/div&gt;
  &lt;button&gt;myMethod()&lt;/button&gt;
  &lt;button&gt;foo()&lt;/button&gt;
  </code></pre>
  
  <p>And there are other ways around this, but the question is for fundamental understanding before making bug or feat.</p>