parent
29231877e6
commit
94dc632a6d
|
@ -65,10 +65,10 @@ import {isBlank, isPresent} from '../facade/lang';
|
||||||
*
|
*
|
||||||
* @stable
|
* @stable
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[ngStyle]', inputs: ['rawStyle: ngStyle']})
|
@Directive({selector: '[ngStyle]'})
|
||||||
export class NgStyle implements DoCheck {
|
export class NgStyle implements DoCheck {
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_rawStyle: {[key: string]: string};
|
_ngStyle: {[key: string]: string};
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_differ: KeyValueDiffer;
|
_differ: KeyValueDiffer;
|
||||||
|
|
||||||
|
@ -77,15 +77,15 @@ export class NgStyle implements DoCheck {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set ngStyle(v: {[key: string]: string}) {
|
set ngStyle(v: {[key: string]: string}) {
|
||||||
this._rawStyle = v;
|
this._ngStyle = v;
|
||||||
if (isBlank(this._differ) && isPresent(v)) {
|
if (isBlank(this._differ) && isPresent(v)) {
|
||||||
this._differ = this._differs.find(this._rawStyle).create(null);
|
this._differ = this._differs.find(this._ngStyle).create(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngDoCheck() {
|
ngDoCheck() {
|
||||||
if (isPresent(this._differ)) {
|
if (isPresent(this._differ)) {
|
||||||
var changes = this._differ.diff(this._rawStyle);
|
var changes = this._differ.diff(this._ngStyle);
|
||||||
if (isPresent(changes)) {
|
if (isPresent(changes)) {
|
||||||
this._applyChanges(changes);
|
this._applyChanges(changes);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue