Useful or not, from you.
angular [Ivy] @ViewChild doesn't read me ElementRef

🐞 bug report

Affected Package

<!-- Can you pin-point one or more @angular/* packages as the source of the bug? --> The issue is caused by package @angular/core

Is this a regression?

Maybe, it seems to be available if we read this status


I'm testing Ivy on a little application with the beta.3 but I have a component like this:

    selector: 'tracklist',
    templateUrl: './tracklist.component.html',
    styleUrls: ['./tracklist.component.css'],
    changeDetection: ChangeDetectionStrategy.OnPush
export class TracklistComponent implements AfterViewInit {
    @ViewChild('matTable', {read: ElementRef}) elRef;

constructor(private route: ActivatedRoute, private renderer: Renderer2) { }

ngAfterViewInit() {
  this.renderer.setStyle(this.elRef.nativeElement, 'overflow-y', 'hidden');

When I run ng serve --aot and I instantiate this component, I have this error:

<pre><code> Error TypeError : Cannot read property 'nativeElement' of undefined </code></pre>

elRef is always undefined.

🌍 Your Environment

Angular Version: <pre><code> Angular CLI: 7.2.4 Node: 10.10.0 OS: darwin x64 Angular: 8.0.0-beta.3 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, platform-server, router ... service-worker

Package Version

@angular-devkit/architect 0.12.4 @angular-devkit/build-angular 0.12.4 @angular-devkit/build-optimizer 0.12.4 @angular-devkit/build-webpack 0.12.4 @angular-devkit/core 7.2.4 @angular-devkit/schematics 7.2.4 @angular/cdk 7.3.1 @angular/cli 7.2.4 @angular/material 7.3.1 @ngtools/webpack 7.2.4 @schematics/angular 7.2.4 @schematics/update 0.12.4 rxjs 6.3.3 typescript 3.2.4 webpack 4.28.4


That's a useful answer
Without any help

While compiling my app with IVY I'm receiving this error ERROR in @ViewChild options must be an object literal.