only apply button class for non item

This commit is contained in:
Adam Bradley
2015-12-05 21:07:15 -06:00
parent 98e81641a7
commit 56496e4f2a

View File

@ -30,10 +30,7 @@ import {Config} from '../../config/config';
*/ */
@Directive({ @Directive({
selector: 'button,[button]', selector: 'button,[button]'
host: {
'class': 'button'
}
}) })
export class Button { export class Button {
@ -50,10 +47,12 @@ export class Button {
} }
if (element.hasAttribute('ion-item')) { if (element.hasAttribute('ion-item')) {
// no need to put on these icon classes for an ion-item // no need to put on these classes for an ion-item
return; return;
} }
renderer.setElementAttribute(elementRef, 'class', 'button');
if (type) { if (type) {
renderer.setElementAttribute(elementRef, type, ''); renderer.setElementAttribute(elementRef, type, '');
} }
@ -85,13 +84,13 @@ export class Button {
if (nodes.length > 1) { if (nodes.length > 1) {
if (nodes[0] === ICON && nodes[1] === TEXT) { if (nodes[0] === ICON && nodes[1] === TEXT) {
element.classList.add('icon-left'); renderer.setElementClass(elementRef, 'icon-left', true);
} else if (nodes[0] === TEXT && nodes[1] === ICON) { } else if (nodes[0] === TEXT && nodes[1] === ICON) {
element.classList.add('icon-right'); renderer.setElementClass(elementRef, 'icon-right', true);
} }
} else if (nodes.length === 1 && nodes[0] === ICON) { } else if (nodes.length === 1 && nodes[0] === ICON) {
element.classList.add('icon-only'); renderer.setElementClass(elementRef, 'icon-only', true);
} }
} }