-
Notifications
You must be signed in to change notification settings - Fork 157
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
Issue with icons in angular-material 0.9.0-rc2. #15
Comments
+1 |
+1, @SimeonC thanks for your work around |
I am not sure if this is a similar issue, but have you tried using an icon from this directive in an input-container like the last form demo on if i use this icon i get the icon completely above and not inline at all. using the following
|
@kevindstanley1988 same here :( |
From looking at the docs, I think you'll need something along these lines: (I haven't tested this one, this is just the css they use in the docs to do that so you'll probably need to tweak it a bit.) md-input-container.md-icon-float>ng-md-icon{
top: 26px;
left: 2px;
}
md-input-container>ng-md-icon{
position: absolute;
top: 5px;
left: 2px;
} |
Currently I've copied all rules related to Hope it helps someone: |
I have added angular-material-icons.css file compiled from angular-material.css v0.9.7, similar to what @rscafi did. Thank you, @rscafi! I haven't tested it though. It would help if someone can use it and check for any issues. |
Using the latest from cdnjs, this is still an issue. However, @SimeonC's solution seems to solve it, so I'm guessing the version on cdnjs is out-of-date? |
This library does not inject any css automatically, nor have I exported css to CDN yet (since it is untested). @SimeonC's solution works, no doubt. |
Is there an issue with using the same element name as the Angular Material library (namely md-icon)? If not, you could rename ng-md-icon to md-icon and take advantage of the Angular Material CSS. |
That's possible simply by changing
to
in the code. However, I'm not sure what side-effects it can result. |
I have found an other fix; adding the rule ng-md-icon svg {
transform: translate3d(0, 25%, 0);
} seems to fix the vertical alignment problem. I don't know if it's pixel-perfect but this is quite good with 32px icons. |
@RomFouq great fix thanks!! |
There is maybe one problem with this fix: the compatibility: http://caniuse.com/#search=translate3d. |
Hi, I've just been through this issue as well. ng-md-icon {
margin: auto;
background-repeat: no-repeat no-repeat;
display: inline-block;
vertical-align: text-bottom;
fill: currentColor;
height: 24px;
width: 24px;
} Hope this helps. |
#25 (merged in mainline) is better solution than custom .css? |
I compiled SVG sprites to use in my project, this is the repository: https://github.com/rcotrina94/svg-material-icons |
this still seems to be an issue. for instance, when using these icons instead of this would be a really nice thing to have work out of the box. any chance of raising this from the dead? |
With angular-material changing all the time, it will be difficult to keep up with compatibility issues. One hack way could be to override md-icon directive itself. See this comment dated Jun 19 regarding this. Then, all css of md-icon will apply, but you cannot use angular-material's md-icon. Please let me know if there is a better solution. |
What about pulling in the sass from angular material and doing a "join"
|
You just need to use the icon like this:
|
@lexfernandez Nice tip... worked perfectly. Don't know why it isn't documented this way. |
Great tip @lexfernandez. I agree this should be part of the documentation for angular-material-icons. |
I found that all the icons are offset above where they should be in 0.9.0-rc2 (I assume this isn't going to change). The fix I found to get this working properly with angular material is the following CSS snippet:
This fixes the icon color not being inherited from the text and the bad positioning.
The text was updated successfully, but these errors were encountered: