Reactive forms validation error

I have a reactive forms. I am trying to validate a username as required. So, I am using form.get(‘username’).touched property. However compiler throws an error. Can someone help please? I am new to Angular.

1 Like


Perhaps it can help you

typescript file


Html file

change the syntax needs to be like this

it works for me.

1 Like