Skip to content

a[md-button] doesn't work without button[md-button] #398

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

Closed
szechyjs opened this issue May 6, 2016 · 5 comments
Closed

a[md-button] doesn't work without button[md-button] #398

szechyjs opened this issue May 6, 2016 · 5 comments

Comments

@szechyjs
Copy link

szechyjs commented May 6, 2016

The following code doesn't properly render buttons.

<md-toolbar color="primary">
    <span>App</span>
    <a md-button color="primary" [routerLink]="['/summary']">Summary</a>
    <a md-button color="primary" [routerLink]="['/log']">View Log</a>
    <a md-button color="primary" [routerLink]="['/metric']">View Metric</a>
    <a md-button color="primary" [routerLink]="['/config']">View Config</a>
</md-toolbar>

screen shot 2016-05-06 at 4 39 46 pm

If I add a button it fixes the a[md-buttons]:

<md-toolbar color="primary">
    <span>App</span>
    <a md-button color="primary" [routerLink]="['/summary']">Summary</a>
    <a md-button color="primary" [routerLink]="['/log']">View Log</a>
    <a md-button color="primary" [routerLink]="['/metric']">View Metric</a>
    <a md-button color="primary" [routerLink]="['/config']">View Config</a>
    <button md-button>FOO</button>
</md-toolbar>

screen shot 2016-05-06 at 4 40 06 pm

Using:

  • angular: 2.0.0-rc.0
  • material: 2.0.0-alpha.4
@kara
Copy link
Contributor

kara commented May 6, 2016

I'm having some trouble replicating this. Did you import MdAnchor into your TS and add it to your directives array? It sounds like it's missing. If not, a plunker or a TS file would be helpful.

@szechyjs
Copy link
Author

szechyjs commented May 6, 2016

Importing MdAnchor as a directive solved my problem.

<md-toolbar color="primary">
    <span>App</span>
    <a md-button [routerLink]="['/summary']">Summary</a>
    <a md-button [routerLink]="['/log']">View Log</a>
    <a md-button [routerLink]="['/metric']">View Metric</a>
    <a md-button [routerLink]="['/config']">View Config</a>
</md-toolbar>

I also had to remove color="primary" else the text color was the same as the background color. Is this correct?

We should probably add something to the docs about MdAnchor.

Thanks for the help!

@kara
Copy link
Contributor

kara commented May 6, 2016

We haven't yet documented MdAnchor, which is pretty confusing. Thanks for bringing it up! I added an issue: #399

Re: color, using md-button gives you a flat button. The color property for a flat button controls the color of its foreground text. Since your toolbar background color is set to the primary color and the button text color is set to that same primary, it is expected that it will be the same. You'll probably want to remove the color attributes from your buttons to ensure they use the default contrast color defined by the toolbar. Hope that helps! Closing this, as it doesn't seem to be a bug.

@kara kara closed this as completed May 6, 2016
@nadavten
Copy link

nadavten commented Jun 11, 2016

angular rc1 , material 5-2 - not working for me

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 4, 2019
alexeagle pushed a commit to alexeagle/material2 that referenced this issue Nov 6, 2024
alexeagle pushed a commit to alexeagle/material2 that referenced this issue Dec 12, 2024
alexeagle pushed a commit to alexeagle/material2 that referenced this issue Dec 16, 2024
alexeagle pushed a commit to alexeagle/material2 that referenced this issue Dec 18, 2024
josephperrott pushed a commit that referenced this issue Dec 18, 2024
alexeagle pushed a commit to alexeagle/material2 that referenced this issue Dec 18, 2024
kseamon pushed a commit to kseamon/material2 that referenced this issue Dec 18, 2024
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

3 participants