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

Add support for [hidden] to md-button #445

Closed
Splaktar opened this issue May 15, 2016 · 5 comments
Closed

Add support for [hidden] to md-button #445

Splaktar opened this issue May 15, 2016 · 5 comments

Comments

@Splaktar
Copy link
Member

Splaktar commented May 15, 2016

  • Do you want to request a feature or report a bug?
    feature
  • What is the current behavior?
    [hidden] is ignored in both anchor and button mode.
  • If the current behavior is a bug,
    please provide steps to reproduce and if possible a minimal demo of the problem:

    http://plnkr.co/edit/ZULwBrp3fHLorUSedYrt?p=preview
  • What is the expected behavior?
    Button should be hidden when expression evaluates to true.
  • What is the motivation / use case for changing the behavior?
    Standard feature request.
  • Which version of Angular and Material, and which browser and OS does this issue affect?
    Did this work in previous versions of Angular / Material?
    Please also test with the latest stable and snapshot versions.
    Chrome. "@angular2-material/button": "2.0.0-alpha.4",
  • Workaround
    Custom CSS:
[hidden][md-button] {
  display: none;
}
@devversion
Copy link
Member

I would like to fix that, by removing the display property on the button-base.

  • Normally the user-agent uses display: inline-block on the button by default, but I imagine, the display property was added intentionally.

@jelbourn
Copy link
Member

We actually consider using the hidden property to be an anti-pattern due to its very poor implementation in browsers and want to recommend that devs either use ngIf or hide elements using a css class.
Kara actually blogged about this topic recently.

Alternatively, you could add

[hidden] {
  display: none !important; 
}

to your own applications, which is similar to what Angular 1 did with ng-hide.

@Splaktar
Copy link
Member Author

Good to know Jeremy. Thank you!

@Hainesy
Copy link

Hainesy commented Nov 9, 2017

ngIf causes problems when trying to use ViewChild in the component class.

andrewseguin pushed a commit to andrewseguin/components that referenced this issue Oct 15, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants