fc.$error 在 AngularJS 中的作用是什么?

what does the fc.$error do in AngularJS formly?

我正在学习如何使用 angular js form,并看到了这个关于必填字段的例子。 http://angular-formly.com/#/example/other/toggle-required

不过这里我不是很懂ng-messages="fc.$error"。为什么是fc.$error? fc从哪里来?我将 fc 更改为任何其他名称,然后它停止工作....

好迷茫,谁能解释一下? 谢谢!

fcoptions.formControl 的快捷方式。请参阅 the docs. The formControl is the field's instance of the NgModelController which is where $error comes from (and that's what ngMessages 预计)。这就是为什么将其他任何东西传递给它都会停止工作的原因。