@@ -14,25 +14,34 @@ export class NzSliderMarksComponent implements OnInit, OnChanges {
1414 // Dynamic properties
1515 @Input ( ) nzLowerBound : number = null ;
1616 @Input ( ) nzUpperBound : number = null ;
17+ @Input ( ) nzMarksArray : MarksArray ;
1718
1819 // Static properties
1920 @Input ( ) nzClassName : string ;
2021 @Input ( ) nzVertical : boolean ; // Required
21- @Input ( ) nzMarksArray : MarksArray ; // Required
2222 @Input ( ) nzMin : number ; // Required
2323 @Input ( ) nzMax : number ; // Required
2424 @Input ( ) nzIncluded : boolean ;
2525
2626 attrs ; // points for inner use
2727
2828 ngOnChanges ( changes : SimpleChanges ) {
29- if ( changes . nzLowerBound || changes . nzUpperBound ) {
29+ if ( changes . nzMarksArray ) {
30+ this . buildAttrs ( ) ;
31+ }
32+ if ( changes . nzMarksArray || changes . nzLowerBound || changes . nzUpperBound ) {
3033 this . togglePointActive ( ) ;
3134 }
3235 }
3336
34- ngOnInit ( ) {
35- const { nzVertical, nzClassName, nzMarksArray, nzMin, nzMax, nzLowerBound, nzUpperBound } = this ;
37+ ngOnInit ( ) { }
38+
39+ trackById ( index : number , attr ) {
40+ return attr . id ;
41+ }
42+
43+ buildAttrs ( ) {
44+ const { nzVertical, nzClassName, nzMarksArray, nzMin, nzMax } = this ;
3645 const range = nzMax - nzMin ;
3746 this . attrs = nzMarksArray . map ( mark => {
3847 const { value, offset, config } = mark ;
@@ -72,11 +81,6 @@ export class NzSliderMarksComponent implements OnInit, OnChanges {
7281 label : label
7382 } ;
7483 } ) ; // END - map
75- this . togglePointActive ( ) ;
76- }
77-
78- trackById ( index : number , attr ) {
79- return attr . id ;
8084 }
8185
8286 togglePointActive ( ) {
0 commit comments