MatButton not styled if in Dialog exported by Angular Library
See original GitHub issueI’ve created an Angular libray by ng g library xxx
with my commons components like a ConfirmDialog using MatDialogModule
In main app <button mat-flat-button color="primary">DIALOG</button>
is correctly styled:
Opening Dialog, buttons are not styled:
Reproduction
I cannot use StackBlitz to reproduce because it not supports angular libraries so I created a repo: https://github.com/fabriziodebortoli/library-material-dialog-styles.git
Steps to reproduce:
- git clone https://github.com/fabriziodebortoli/library-material-dialog-styles.git
- cd library-material-dialog-styles
- npm install
- npm start
Expected Behavior
Buttons inside Dialogs must be styled
Actual Behavior
What behavior did you actually see?
Environment
- Angular: ~9.0.3
- CDK/Material: ~9.1.0
- Browser(s): Latest Chrome
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:14 (6 by maintainers)
Top Results From Across the Web
Angular 4 Material - mat-button style not being applied in mat ...
Newly imported modules need to be added to imports : import { MatButtonModule } from '@angular/material/button' @NgModule{ ... imports: ...
Read more >Button - Angular Material
The MatButton class applies to native button elements and captures the ... Exported as: matButton ... Default color to fall back to if...
Read more >InDepth Guide for Customizing Angular Material Button
In the first part of this tutorial we will learn how to modify styles so that our changes do not conflict with future...
Read more >Easy Dialogs with Angular Material | Articles by thoughtram
We're injecting MatDialog into our component and call its open() method with the FileNameDialogComponent type when a user wants to add a file....
Read more >Angular Material Dialog: A Complete Example
hasBackdrop : defines if the dialog should have a shadow backdrop, ... This is just a regular Angular component, as it does not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fabriziodebortoli I don’t know what you tried or not, but what I can see is that your repository does not have the direct import replaced in the app component. Surely you might have tried that before, but I can only assume you did not. Fixing that import, along with bullet points (1), (2) and (3), makes it work for me.
https://github.com/fabriziodebortoli/library-material-dialog-styles/blob/master/src/app/app.component.ts#L3
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.