Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 5afd10d

Browse files
committed
make directive more semantic, add known issues and roadmap
1 parent ec9db82 commit 5afd10d

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

README.md

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,47 @@ Slider directive implementation for AngularJS, without jQuery dependencies.
99
<li ng-repeat="item in items">
1010
<p>Name: {{item.name}}</p>
1111
<p>Cost: {{item.cost}}</p>
12-
<slider min="100" max="1000" step="50" value="item.cost"></slider>
12+
<slider min="100" max="1000" step="50" ng-model="item.cost"></slider>
1313
</li>
1414
</ul>
1515

16+
### Styles:
17+
18+
No styles are included at the moment. You must apply your own styles to *slider* and *slider-button*
19+
Example:
20+
21+
slider,
22+
slider-button {
23+
position: relative;
24+
display: block;
25+
}
26+
slider {
27+
width: 75%;
28+
height: 20px;
29+
background-color: #fff;
30+
border: 1px solid;
31+
z-index: 0;
32+
}
33+
slider slider-button {
34+
z-index: 1;
35+
background-color: #00f;
36+
width: 6%;
37+
height: 100%;
38+
}
39+
1640

1741
### Known issues:
1842

1943
1. When applying filters or orders within an ng-repeat directive, the element can abruptly change its position when the value attached to the slider causes a filter to activate or the order to change.
20-
Example: In the above snippet, it would be a very bad idea to order the list by item.cost.
44+
Example: In the above snippet, it would be a very bad idea to order the list by item.cost.
45+
46+
2. Sometimes an additional value is available in the slider at one end. In the above slider snipped, the lowest value could be 99 instead of 100.
47+
48+
49+
### Roadmap:
50+
51+
1. Add range slider support (2 slider-buttons).
52+
53+
2. Add classes to slider and slider-button on certain events (mouseover, mousedown, etc) to help styling.
54+
55+
3. Test suite.

angular-slider.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

angular-slider.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
3+
coffee -bc src/angular-slider.coffee
4+
5+
mv src/angular-slider.js ./
6+
7+
uglifyjs angular-slider.js -mc > angular-slider.min.js

src/angular-slider.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ BUTTON_EL = 'slider-button'
66
sliderDirective = ->
77
restrict: 'E'
88
scope:
9-
value: '='
9+
value: '=ngModel'
1010
template: "<#{BUTTON_EL} ng-model=\"value\"></#{BUTTON_EL}>"
1111

1212
sliderButtonDirective = ->

0 commit comments

Comments
 (0)