Set focus on element

Edit 2022: Read a more modern way with @Cichy’s answer below Modify the show search method like this showSearch(){ this.show = !this.show; setTimeout(()=>{ // this will make the execution after the above boolean has changed this.searchElement.nativeElement.focus(); },0); }

Load new modules dynamically in run-time with Angular CLI & Angular 5

I was facing the same problem. As far as I understand it until now: Webpack puts all resources in a bundle and replaces all System.import with __webpack_require__. Therefore, if you want to load a module dynamically at runtime by using SystemJsNgModuleLoader, the loader will search for the module in the bundle. If the module does … Read more

Read response headers from API response – Angular 5 + TypeScript

Have you exposed the X-Token from server side using access-control-expose-headers? because not all headers are allowed to be accessed from the client side, you need to expose them from the server side Also in your frontend, you can use new HTTP module to get a full response using {observe: ‘response’} like http .get<any>(‘url’, {observe: ‘response’}) … Read more