Components: Documentation lacks some serious important info

Created on 27 Aug 2018  路  3Comments  路  Source: angular/components

Hello.

The documentation lacks a lot of info and is incomplete. Fixing this would take max 5 minutes so i really don't understand how this hasn't been fixed yet.

The select component, for example:

https://material.angular.io/components/select/examples

The documentation fails to point out all of the dependencies, in this particular example me and a lot of people (judging by how popular the question is on StackOverflow) found out that you need to also import ReactiveFormsModule only by stumbling upon the error, googling and then reading this cry for help:

https://stackoverflow.com/questions/43220348/cant-bind-to-formcontrol-since-it-isnt-a-known-property-of-input-angular/43220824#43220824

Just that. Thanks.

Most helpful comment

While I agree that the documentation could use improvement in some areas, I'd also like to point out that comments like

Fixing this would take max 5 minutes so i really don't understand how this hasn't been fixed yet

really just leave you wide open for responses like "kindly invest 5 minutes of _your_ time.. to submit a pull request". No need to be a wise guy about it.

But more to the point, I don't agree that the documentation in this case "fail[s] to point out all of the dependencies". It omits extraneous details that are not related to the core component, which is the select. The error Can't bind to 'formControl' since it isn't a known property of 'input' is a _standard Angular error_, relating to the _Angular_ module for reactive forms, and as such, you can find the relevant documentation for this error in the Angular ReactiveFormsModule docs.

If you're going to complain about not being able to blindly copy-paste from that example, then by extension of logic, every single example should also include:

  • a main.ts, AppModule, component declaration, etc
  • <app-root> and all extraneous markup
  • required polyfills
  • module system
  • every single @angular/... scoped import
  • the list goes on, because these are _all_ required to run the example

That's silly, and the fact that you decided to toss this issue onto a pile of 1000+ others instead of griping on StackOverflow like the rest of the people who don't read the Angular docs is a wonder to me. Please close.

All 3 comments

While I agree that the documentation could use improvement in some areas, I'd also like to point out that comments like

Fixing this would take max 5 minutes so i really don't understand how this hasn't been fixed yet

really just leave you wide open for responses like "kindly invest 5 minutes of _your_ time.. to submit a pull request". No need to be a wise guy about it.

But more to the point, I don't agree that the documentation in this case "fail[s] to point out all of the dependencies". It omits extraneous details that are not related to the core component, which is the select. The error Can't bind to 'formControl' since it isn't a known property of 'input' is a _standard Angular error_, relating to the _Angular_ module for reactive forms, and as such, you can find the relevant documentation for this error in the Angular ReactiveFormsModule docs.

If you're going to complain about not being able to blindly copy-paste from that example, then by extension of logic, every single example should also include:

  • a main.ts, AppModule, component declaration, etc
  • <app-root> and all extraneous markup
  • required polyfills
  • module system
  • every single @angular/... scoped import
  • the list goes on, because these are _all_ required to run the example

That's silly, and the fact that you decided to toss this issue onto a pile of 1000+ others instead of griping on StackOverflow like the rest of the people who don't read the Angular docs is a wonder to me. Please close.

I agree with everything @wosevision said. The ReactiveFormsModule import is basic Angular boilerplate and not directly related to Angular Material or to mat-select. Most of the examples on that page don't use it at all. If you click the StackBlitz icon in the upper right corner of each snippet you will find complete functional examples including all boilerplate.

FYI though, if you're blindly importing ReactiveFormsModule without knowing what it does because a few examples on that page use it, you might find yourself surprised by the behavior. That module, and [formControl], do a lot more than you might think and may not be what you want in your app. I suggest looking at some of the other examples on that page, since most of them (including the first one), don't use formControl at all.

You should look at the documentation for Reactive Forms and compare to Template-driven Forms and Dynamic Forms.

Fixing this would take max 5 minutes so i really don't understand how this hasn't been fixed yet.

Please see Angular's Code of Conduct.

Was this page helpful?
0 / 5 - 0 ratings