StyleGuide - Limit the usage of forwardRef
To be discussed ...
I copied several of these from early discussions and will list them as issues for future discussion after ngConf
cc // @mgechev @wardbell
-
Limit the usage of
forwardRef.Why?: The usage of
forwardRefindicates either a cyclic dependency or inconsistency in the services' declaration (i.e. the dependent service is declared before its dependency). In both cases there is usually a better approach to be used.
One place where forwardRef seems necessary is when components need to provide value accessors, e.g. for custom form controls. An example can be found in md-checkbox which provides a ControlValueAccessor so it can be used similar to a native checkbox. I'm not sure if there's been a better solution implemented since this code was written though.
Hi guys. Has anybody come up with how to make custom form controls without using forwardRef?
No solution here with Angular 4. @opporancisis did you find one?