Skip to content

Commit cf391bf

Browse files
committed
Actions with sliders
1 parent 0426e09 commit cf391bf

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

app/controllers/slider.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,15 @@ import Ember from 'ember';
22

33
export default Ember.ObjectController.extend({
44
num: 50,
5-
vals: [10, 90]
5+
vals: [10, 90],
6+
text: "50%",
7+
num2: 50,
8+
didSlideBasic: function() {
9+
this.set('num2', this.get('num'));
10+
}.observes('num'),
11+
actions: {
12+
didSlide: function(event, ui) {
13+
this.set('text', ui.value + "%");
14+
}
15+
}
616
});

app/templates/slider.hbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44

55
<h2>Range Slider</h2>
66
{{jqui-slider values=vals min=0 max=100 step=10 range=true}} &nbsp; {{vals.firstObject}} - {{vals.lastObject}}
7-
<p>Just add <code>\{{jqui-slider values=vals min=0 max=100 step=10 range=true}} \{{vals.firstObject}} - \{{vals.lastObject}}</code> to any template in your application.</p>
7+
<p>Just add <code>\{{jqui-slider values=vals min=0 max=100 step=10 range=true}} \{{vals.firstObject}} - \{{vals.lastObject}}</code> to any template in your application.</p>
8+
9+
<h2>Custom Slider</h2>
10+
{{jqui-slider value=num2 min=0 max=100 step=10 slideAction="didSlide"}} &nbsp; {{text}}

0 commit comments

Comments
 (0)