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!
fcis a shortcut foroptions.formControl. See the docs. TheformControlis the field's instance of theNgModelControllerwhich is where$errorcomes from (and that's what ngMessages is expecting). This is why passing anything else to it stops working.