ng-ytl-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
49 lines (41 loc) • 1.16 kB
text/typescript
import { Component, OnInit } from '@angular/core';
export class NzDemoSliderIconComponent implements OnInit {
min = 0;
max = 20;
mid = parseFloat(((this.max - this.min) / 2).toFixed(5));
preIconClassMap = {
'anticon' : true,
'anticon-frown-o': true
};
nextIconClassMap = {
'anticon' : true,
'anticon-smile-o': true
};
_sliderValue;
set sliderValue(value: number) {
this._sliderValue = value;
this.highlightIcon();
}
get sliderValue() {
return this._sliderValue;
}
ngOnInit() {
this.sliderValue = 0;
}
highlightIcon() {
const lower = this._sliderValue >= this.mid;
this.preIconClassMap[ 'anticon-highlight' ] = !lower;
this.nextIconClassMap[ 'anticon-highlight' ] = lower;
}
}