with "banner works! ngAfterViewInit () is used to handle any additional initialization tasks. All browser compatibility updates at a glance, Frequently asked questions about MDN Plus. You can more article links below this link, which contain more use cases for unit testing in Angular. we will able to get element width and height in angular 6, angular 7, angular 8, angular 9, angular 10, angular 11, angular 12, angular 13, angular 14 and angular 15 version. Open the src/app/makered/makered.directive.ts file and update it as follows: We import both ElementRef and Renderer2 and we inject them via the directive's constructor. En este primer ejemplo, obtendremos el primer elemento