refactor(item): add .item-icon to child icons

This commit is contained in:
Adam Bradley
2016-01-04 13:24:03 -06:00
parent aefcbeeb00
commit 1a1cdfb886
2 changed files with 15 additions and 0 deletions

View File

@@ -48,6 +48,13 @@ export class Icon {
this.mode = config.get('iconMode');
}
/**
* @private
*/
addClass(className) {
this._renderer.setElementClass(this._elementRef, className, true);
}
/**
* @private
*/

View File

@@ -1,6 +1,7 @@
import {Component, ContentChildren} from 'angular2/core';
import {Button} from '../button/button';
import {Icon} from '../icon/icon';
/**
@@ -65,4 +66,11 @@ export class Item {
set _buttons(buttons) {
Button.setRoles(buttons, 'item-button');
}
@ContentChildren(Icon)
set _icons(icons) {
icons.toArray().forEach(icon => {
icon.addClass('item-icon');
});
}
}