Open ommyan opened 7 years ago
@ommyan you need to assign your new properties when instantiating the app-knob component and inside this component in the OnInit method, you can assign your input values to options property of knob directive.
import { Component, OnInit , Input} from '@angular/core';
@Component({
selector: 'app-knob',
templateUrl: './knob.component.html',
styleUrls: ['./knob.component.css']
})
export class KnobComponent implements OnInit {
@Input () size;
@Input () fontsize;
@Input () subtext;
@Input () persent;
knOptions: any = {}
ngOnInit() {
this.knOptions = {
readOnly: true,
unit: '%',
textColor: '#000000',
size: this.size,
fontSize: this.fontsize,
fontWeigth: '700',
fontFamily: 'Roboto',
valueformat: 'percent',
value: 0,
max: 100,
trackWidth: 19,
barWidth: 20,
trackColor: '#D8D8D8',
barColor: '#FF6F17',
subText: {
enabled: true,
fontFamily: 'Verdana',
font: '14',
fontWeight: 'bold',
text: this.subtext,
color: '#000000',
offset: 7
},
}
}
}
Then you can instantiate the k-nob directly without your new inputs, these properties will be passed to the directive inside options values.
<div ui-knob [value]="persent" [options]="knOptions"></div>
i tried to make configurable size and subtext options, like this
`
HTML template
in usage
not working, knob not rendering does anyone know to do that?