0

I got an Error message that says ERROR TypeError: Cannot read property 'value' of undefined. I'm using Angular CLI, Typescript, and HTML-Table. I checked the codes but i do not think it causes by typos. Can anyone help me with this error?

//function in typescript
updStudent(newName: string, newYear: string, newSemester: string, newScore: string) {
  this.stockService.updStudent(this.selectedStudent.id, newName, newYear, newSemester, newScore).subscribe;
}
loadStu(Student: any) {
  this.updateEnable = true;
  this.selectedStudent = Student;
}
<!--button-->
<button type="button" (click)="loadStu(Student)">UPDATE</button>
<hr>

<!--form-->
<div *ngIf="updateEnable">
  id: <input disabled [value]="selectedStudent.id" />
  <br>name: <input name="name" #updName [value]="selectedStudent.name" />
  <br>year: <input name="year" #updYear [value]="selectedStudent.year" />
  <br>semester: <input name="semester" #updSemester [value]="selectedStudent.semester" />
  <br>score: <input name="score" #updScore [value]="selectedStudent.score" />
  <br><button type="button" (click)="updStudent(updName.value, updYear.value, updSemester.value, UpdScore.value)">SAVE</button>
</div>

Please let me know if more snippets are needed.

Thank you.

1 Answer 1

1

Its typo , please change

UpdScore.value

To

updScore.value
Sign up to request clarification or add additional context in comments.

2 Comments

wow so it's really a typo, pardon for my carelessness. Thanks for the answer :)
I Can accept the answer in one minutes it said when i clicked the check button, please wait, i will accept it soon :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.