Cannot read property 'required' of null

前端 未结 5 2153
悲哀的现实
悲哀的现实 2021-02-05 06:05

In the template I have a form, which one part of it has to do with rendering the list of courses:

5条回答
  •  耶瑟儿~
    2021-02-05 06:37

    The code below worked for me. The '?' after courseCategory is not necessary, however, it's a workaround for a bug in Visual Studio code where the linter flags courseCategory.errors?.required" as an error stating that 'required is not defined. So for VSCode users, there's the patch until an official one is made. *ngIf="courseCategory.touched && courseCategory?.errors?.required"

提交回复
热议问题