darul75 / angular-awesome-slider

:arrows_clockwise: Angular slider control directive
http://darul75.github.io/angular-awesome-slider/
MIT License
144 stars 63 forks source link

Dynamic ID #21

Closed graphefruit closed 9 years ago

graphefruit commented 10 years ago

Hello,

if you choose to take dyanmic Id's and render them via angular

<input ng-model="value"   type="text" id="{{ id }}"slider options="options" />

The Slider isn't working cause he grabs the ID before its filled.

Workaround in the actual plugin:

scope.id=createDynamicId();
element.attr("id",scope.id);
scope.sliderTmplId = scope.id+ '-slider-span';
scope.sliderScaleDivTmplId =scope.id + '-slider-scale';

I create a dynamic id and set the attribute of it into the input element.

I need to do this, cause the JSlider i build up in a self custom directive of my project.

Maybe any better solutions available?

Greetings

darul75 commented 10 years ago

I try to look deeper and check directive priority rules, can you give your angular version as they may have made some changes in handling interpolatation priority order..

https://github.com/angular/angular.js/issues/4511

darul75 commented 10 years ago

can you give a try to this

<input ng-model="value"   type="text" ng-attr-id="{{ id }}" slider options="options" />
graphefruit commented 10 years ago

Hey Darul, thanks for feedback, I'll try this later on. Angular Version: AngularJS v1.2.14 Greetings

graphefruit commented 10 years ago

Hey Darul, sorry its not working

darul75 commented 10 years ago

Well i guess it is related to interpolation which normaly occured...at right time or not...I have seen some discussions about it, postLink functions etc..but it is relatively tricky. Can you post a fiddler about it

darul75 commented 9 years ago

new version should avoid this, I keep you in touch

darul75 commented 9 years ago

do not cause problem anymore