我是輸入了以下CODE:
get selectedColorRed() {
return this.surveyForm.get('otherQuestions').get('favoriteColorRed').value;
}
get selectedColorGreen() {
return this.surveyForm.get('otherQuestions').get('favoriteColorGreen').value;
}
get selectedColorBlue() {
return this.surveyForm.get('otherQuestions').get('favoriteColorBlue').value;
}
// 組合顏色樣式
get selectedColorStyle() {
return `rgb(${this.selectedColorRed}, ${this.selectedColorGreen}, ${this.selectedColorBlue})`;
}
但是不知道,那裏出現問題,它有ERROR出現。在網上試過找找方法,都找不到。
ERROR TypeError: Cannot read property 'get' of null at AppComponent.get selectedColorRed [as selectedColorRed]
THANK YOU VERY MUCH.
reference:
[https://ithelp.ithome.com.tw/articles/10195509](https://ithelp.ithome.com.tw/articles/10195509)