It's really weird.
$(function(){
$('.dial').knob({
return value + '%';
});
});
That was my original code to get the percent sign to show up, which works great. For some reason, when the value is 0, on page load it displays as NaN
. The weird thing is that only once you highlight the text and then click off does it show the actual value of 0 (replacing the NaN
value). Any idea what is causing this to happen? I tried to handle it in the format hook:
$(function(){
$('.dial').knob({
'format': function( value ){
if(value == undefined || value == NaN {
value = 0;
return value + '%';
}
else{
return value + '%';
}
}
});
});
It still doesn't work. I console logged the value I'm passing in, and sure enough it is 0. I'm thinking it may be an 'x loads before y' and therefore it sees the value as undefined, since I am passing in the value attribute by an angularJS data binding. But I'm trying to handle it to no avail. Any thought's on this?