angular / material.angular.io

Docs site for Angular Components
http://material.angular.io
MIT License
890 stars 395 forks source link

Why do the stackbliz examples not follow angular best practices? #1207

Open IsaacSomething opened 1 year ago

IsaacSomething commented 1 year ago

Documentation Feedback

All of the stackbliz examples in the angular material documentation include one large root material file with all the components. So if someone is looking at the example for mat-menu, in the stackbliz example all of the components are loaded just for the mat-menu.

This goes against angular material best practices on feature modules and can easily lead to newbies adapting bad practices by following the example from the lead developers. The "correct way" is even outlined in your "Getting Started" guide, but not followed by the examples on stackbliz OR in the examples in the documentation.

IMHO the angular material documentation all seems a bit lazy (please see this as constructive) some of the code examples have private members with an underscore some of them dont, some of the examples have 2 components in one file (also against angular best practices). It all just seems really boring for a very cool UI/UX framework. Also, none of the examples use lazy loading which i a pretty sure is standard by now. Again, this is outlined in the guide but not the actual examples for each component, why? Why have a code examples when that code example is a bad outdated practice?

Some of the examples also seem to be be lacking. One good example for how bad it seems is the CDK overlay component. There is one example yet this module is so dynamic and allows the developer to really enhance a custom look and feel, yet im pretty sure most people will go to stackoverflow for most questions regarding setup of anything else other than open and close functionality, or even just use another module completely ( which i have seen a few times). The documentation talks about position and scroll strategies but it is never actually shown as code implementation. It is such a fun little module but it seems completely overlooked in the documentation, like it is an after thought.

Another is the Portal module. Such a awesome module, yet i know people who have been using material for years that dont even know about it. The portal module would also be such an amazing place to introduce newbies to token based injection in angular.

Affected documentation page

https://material.angular.io/cdk/overlay/examples

kian23kpt commented 1 year ago

I think this issue was solved by adding standalone components. in the mat-menu stackbliz example just MatMenuModule imported in ts file. so this issue could be closed. @amysorto @IsaacSomething

Screenshot from 2023-06-28 13-41-51