I have a code:
document.getElementById(\'loginInput\').value = \'123\';
But while compiling the code I receive following error:
if you want to set value than you can do the same in some function on click or on some event fire.
also you can get value using ViewChild using local variable like this
and get value like this
this.abc.nativeElement.value
here is working example
okay got it , you have to use ngAfterViewInit method of angualr2 for the same like this
ngAfterViewInit(){
document.getElementById('loginInput').value = '123344565';
}
ngAfterViewInitwill not throw any error because it will render after template loading