Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

StyleGuide - Limit the usage of forwardRef #1151

Open
johnpapa opened this issue Apr 24, 2016 · 3 comments
Open

StyleGuide - Limit the usage of forwardRef #1151

johnpapa opened this issue Apr 24, 2016 · 3 comments

Comments

@johnpapa
Copy link
Contributor

johnpapa commented Apr 24, 2016

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 forwardRef indicates 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.

@traviskaufman
Copy link

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.

@opporancisis
Copy link

Hi guys. Has anybody come up with how to make custom form controls without using forwardRef?

@meriturva
Copy link

No solution here with Angular 4.
@opporancisis did you find one?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants