(<HTMLInputElement>document.getElementById('loginInput')).value = '123';
When working with Angular, it is important to note that HTML elements cannot be directly accessed. You must specify the element type by binding a generic reference to it.
UPDATE::
Another approach is to use ViewChild with a local variable defined like #someVar in the following example, which is also mentioned here
<textarea #someVar id="tasknote"
name="tasknote"
[(ngModel)]="taskNote"
placeholder="{{ notePlaceholder }}"
style="background-color: pink"
(blur)="updateNote() ; noteEditMode = false " (click)="noteEditMode = false"> {{ todo.note }}
</textarea>
import {ElementRef,Renderer2} from '@angular/core';
@ViewChild('someVar') el:ElementRef;
constructor(private rd: Renderer2) {}
ngAfterViewInit() {
console.log(this.rd);
this.el.nativeElement.focus(); //<<<=====same as oldest way
}