import {Component,OnInit,Input,Output,EventEmitter} from '@angular/core'; @Component({ selector: 'cm-slider-doc-3', templateUrl: './slider-doc-3.component.html', styleUrls: ['./slider-doc-3.component.css'] }) export class SliderDoc3Component 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:number; 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; } }