Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tree: importing MatIconModule and MatButtonModule is necessary #20239

Open
tom-richter opened this issue Jul 30, 2020 · 4 comments
Open

tree: importing MatIconModule and MatButtonModule is necessary #20239

tom-richter opened this issue Jul 30, 2020 · 4 comments

Comments

@tom-richter
Copy link

@tom-richter tom-richter commented Jul 30, 2020

It would be helpful to mention in the API reference for Angular Material tree that besides the MatTreeModule also MatIconModule and MatButtonModule must be imported into the app.module.ts.
(eg. when you use a "Tree with flat nodes")

import {MatButtonModule} from '@angular/material/button';
import {MatIconModule} from '@angular/material/icon';
import {MatTreeModule} from '@angular/material/tree';
@tom-richter tom-richter changed the title API reference for Angular Material tree - MatIconModule and MatButtonModule API reference for Angular Material tree - MatIconModule and MatButtonModule also necessary Jul 30, 2020
@Splaktar Splaktar changed the title API reference for Angular Material tree - MatIconModule and MatButtonModule also necessary tree: importing MatIconModule and MatButtonModule is necessary Aug 7, 2020
@Splaktar
Copy link
Member

@Splaktar Splaktar commented Aug 7, 2020

As this is docs' content, I'll move this over the the Components repo. This repo is only for docs infrastructure.

@Splaktar Splaktar transferred this issue from angular/material.angular.io Aug 7, 2020
@crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 9, 2020

For what it's worth, the icon and button modules aren't mandatory for the tree to work, but they are needed if you wanted to replicate the demo from the docs. We should still mention it somewhere in the docs.

@romualdnave
Copy link

@romualdnave romualdnave commented Aug 26, 2020

@crisbeto Considering most of the components usage examples are using mat-icon-button directive or <mat-icon> selector would this still be relevant (another example being the Menu component) ? Should some kind of global mention to these necessary imports be considered in the documentation then ?

@tom-richter
Copy link
Author

@tom-richter tom-richter commented Aug 31, 2020

Yes, for me as an Angular Material beginner I copied the code from the documentation and spent half an hour debugging until I found out why the material tree style is not applied. There is no descriptive error message. The tree just looks strange like in this issue:
https://stackoverflow.com/questions/57527296/material-tree-style-not-being-applied/63174068#63174068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.