How to get elementRef of an Ionic control like a Content, a toolbar or a Card?

As of beta.6:

If you don’t want the nativeElement but rather like to have the Ionic/Stencil object/component, do as you displayed

 @ViewChild(Toolbar) toolbar: Toolbar;

if you do want the ElementRef respectively the nativeElement do as following (the read attribute is the key)

<ion-toolbar #myToolbar></ion-toolbar>

@ViewChild('myToolbar', {read: ElementRef}) toolbar: ElementRef;
4 Likes