import ngModule from '../../module'; import './style.scss'; class Icon { constructor($attrs) { this.$attrs = $attrs; this._icon = null; } set icon(value) { this._icon = value; this.drawIcon(); } get icon() { return this._icon; } drawIcon() { if (this.icon.startsWith('icon-')) { this.iconClass = this.icon; this.iconContent = ''; } else { this.iconClass = 'material-icons'; this.iconContent = this.icon; } } } Icon.$inject = ['$attrs']; ngModule.component('vnIcon', { template: '{{::$ctrl.iconContent}}', controller: Icon, bindings: { icon: '@' } });