klarsys/angular-material-icons

Icon not centering in Angular Material

essesse opened this issue · 1 comments

When setting the size of an icon it was not being centered in an element when it should have been (using layout-align="center center"). Setting the icon size to "48" produced an icon with the correct size, but the parent ng-md-icon element still had css properties (height/width) set to 24px.

A potential solution is as follows around line 38:

// size
if (attr.size !== undefined) {
size = attr.size;
}

changes to:

// size
if (attr.size !== undefined) {
size = attr.size;
element.css('height', size + 'px');
element.css('width', size + 'px);
}

This inlined the css styles and fixed the issue.

Cheers

Simon

That's a good idea, @essesse.