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

341 views Asked by At

I am learning how to use angular js formly, and saw this example about required field. http://angular-formly.com/#/example/other/toggle-required

But I don't really understand ng-messages="fc.$error" here. Why it is fc.$error? where does the fc come from? I changed the fc to any other name, then it stops working....

so confused, anyone could explain? Thanks!

1

There are 1 answers

0
kentcdodds On BEST ANSWER

fc is a shortcut for options.formControl. See the docs. The formControl is the field's instance of the NgModelController which is where $error comes from (and that's what ngMessages is expecting). This is why passing anything else to it stops working.