-
-
Notifications
You must be signed in to change notification settings - Fork 497
Expose label on scope in template #358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose label on scope in template #358
Conversation
I just checkout your code and first reverse the logic about the Here is my translateFn method: translateFn: function(value, label, which, useCustomTr) {
useCustomTr = useCustomTr === undefined ? true : useCustomTr;
var valStr = '',
getDimension = false,
dontInjectLabel = label.hasClass('dont-inject-label')
if (useCustomTr) {
if (this.options.stepsArray)
value = this.getStepValue(value);
valStr = String(this.customTrFn(value, this.options.id, which));
}
else {
valStr = String(value)
}
if (label.rzsv === undefined || label.rzsv.length !== valStr.length || (label.rzsv.length > 0 && label.rzsd === 0)) {
getDimension = true;
label.rzsv = valStr;
}
if(!dontInjectLabel)
label.html(valStr);
this.scope[which + 'Label'] = valStr;
// Update width only when length of the label have changed
if (getDimension) {
this.getDimension(label);
}
} Can you try it and tell me if you can still get the positioning problem? |
@ValentinH Did you set the label using angular binding, like |
Nope I just use the code you added in the demo with the custom directive. |
@ValentinH |
13f1fbe
to
c86c310
Compare
Current coverage is 100%@@ master #358 diff @@
====================================
Files 1 1
Lines 838 839 +1
Methods 0 0
Messages 0 0
Branches 0 0
====================================
+ Hits 838 839 +1
Misses 0 0
Partials 0 0
|
@@ -1,4 +1,4 @@ | |||
## AngularJS slider directive with no external dependencies | |||
e# AngularJS slider directive with no external dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably modify this line by mistake ;)
f1b2658
to
6256583
Compare
6256583
to
2fa3760
Compare
👍 Great job man! It's the best PR I've seen since I maintain this project, everything is here: documentation, tests, etc. Thanks! :) |
@ValentinH If it's looking good, I'll send one for gh-pages as well. |
@ValentinH Oh that's nice, thanks man :) |
Gonna fix #355