Components: Button hide error

Created on 31 Aug 2017  路  3Comments  路  Source: angular/components

Bug, feature request, or proposal:

[hidden] property doesn't work in Buttons

What is the expected behavior?

Hide the button when the [hidden] property is true

What is the current behavior?

When the property is true it is not hiding the button

What are the steps to reproduce?

http://plnkr.co/edit/qUHhZElRoOXs2xKlYjyb

What is the use-case or motivation for changing an existing behavior?

I want to have just one button to show or hide a card content

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

"@angular/core": "^4.0.0",
"@angular/material": "^2.0.0-beta.8",
Chrome Browser

All 3 comments

Just use *ngIf

The hidden attribute sets display: none through the user agent styles, which makes it really low specificity. Material sets buttons to display: inline-block through a class selector which ends up overriding the native styling. You can either use *ngIf, or add this somewhere in your stylesheet to guarantee that it can't be overridden:

[hidden] {
  display: none !important;
}

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xtianus79 picture xtianus79  路  3Comments

jelbourn picture jelbourn  路  3Comments

theunreal picture theunreal  路  3Comments

crutchcorn picture crutchcorn  路  3Comments

michaelb-01 picture michaelb-01  路  3Comments