# Reactive forms validation error

**URL:** <https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826>\
**Category:** Angular\
**Created:** [April 3, 2021, 8:19am UTC](https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826 "2021-04-03T08:19:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sailesh](https://avatars.discourse-cdn.com/v4/letter/s/f07891/32.png) [@Sailesh](https://forum.codewithmosh.com/u/Sailesh)\
**Post date:** [April 3, 2021, 8:19am UTC](https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826/1 "2021-04-03T08:19:41Z")

</div>

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.

 ![error](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/1/1027ae44f204c0a499c46c8a7c257b451e467479.png)

---

<div class="post-metadata">

**Author:** ![husain.asfak](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@husain.asfak](https://forum.codewithmosh.com/u/husain.asfak)\
**Post date:** [May 26, 2021, 1:47pm UTC](https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826/2 "2021-05-26T13:47:30Z")

</div>

![code-snapshot](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/b/b308acc27a486e016aee1fe7e8efcae274462f01.png)  
**Perhaps it can help you**

**typescript file**

---

<div class="post-metadata">

**Author:** ![husain.asfak](https://avatars.discourse-cdn.com/v4/letter/h/87869e/32.png) [@husain.asfak](https://forum.codewithmosh.com/u/husain.asfak)\
**Post date:** [May 26, 2021, 1:48pm UTC](https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826/3 "2021-05-26T13:48:09Z")

</div>

![inputHtml](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/6/66c90775aee7ad6d53fd2e6a32bbf260aad49cfb.png)  
**Html file**

---

<div class="post-metadata">

**Author:** ![smahmoodi](https://avatars.discourse-cdn.com/v4/letter/s/a587f6/32.png) [@smahmoodi](https://forum.codewithmosh.com/u/smahmoodi)\
**Post date:** [February 25, 2022, 9:28pm UTC](https://forum.codewithmosh.com/t/reactive-forms-validation-error/3826/4 "2022-02-25T21:28:38Z")

</div>

change the syntax needs to be like this

 ![touched](https://us1.discourse-cdn.com/flex020/uploads/codewithmosh/original/2X/4/4dbd87f26f35333a13b3fdc7a4eca6585137658e.jpeg)

it works for me.
