我如何改变这一点:
ng-messages="createCourseForm.quizItemMultipleChoiceAnswer+$index.$error"
成:
ng-messages="createCourseForm.quizItemMultipleChoiceAnswer0.$error"
答案 0 :(得分:1)
It looks like you are trying to access a specifically named property from your form. If you need the property name to be variable, you can use javascript's bracket notation来访问属性。然后,您可以传入任何字符串并访问该属性。
ng-messages="createCourseForm['quizItemMultipleChoiceAnswer' + $index].$error"