question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MatButton not styled if in Dialog exported by Angular Library

See original GitHub issue

I’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: image

Opening Dialog, buttons are not styled: image

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:

  1. git clone https://github.com/fabriziodebortoli/library-material-dialog-styles.git
  2. cd library-material-dialog-styles
  3. npm install
  4. 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:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
devversioncommented, Jun 3, 2020

@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

0reactions
angular-automatic-lock-bot[bot]commented, Jul 8, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found