feat(item): listen for core $ionStyle events

This commit is contained in:
Adam Bradley
2017-05-24 14:44:26 -05:00
parent 5cca46b5ad
commit 9c20f10a1d

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, QueryList, Renderer, Optional, ViewChild, ViewEncapsulation } from '@angular/core';
import { ChangeDetectionStrategy, Component, ContentChild, ElementRef, HostListener, QueryList, Renderer, Optional, ViewChild, ViewEncapsulation } from '@angular/core';
import { Config } from '../../config/config';
import { Form } from '../../util/form';
@ -334,6 +334,15 @@ export class Item extends Ion {
}
}
@HostListener('$ionStyle', ['$event'])
itemStyle(ev: any) {
ev.stopPropagation();
Object.keys(ev.detail).forEach(cssClassName => {
this._elementRef.nativeElement.classList[ev.detail[cssClassName] ? 'add' : 'remove']('item-' + cssClassName);
});
}
/**
* @hidden
*/