-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcontroller2.js
More file actions
34 lines (29 loc) · 945 Bytes
/
controller2.js
File metadata and controls
34 lines (29 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function mainCtrl($scope){
$scope.hello = "hello"; //first input text
$scope.goodbye = "goodbye"; //second input text
$scope.sliderValue1 = 175;
$scope.sliderValue2 = 75;
}
angular.module('myApp', [])
.directive('slider', function() {
return {
restrict:'A',
link:function(scope,element,attrs){
element.slider({
min: 0,
max: 500,
value: 75,
slide: function( event, ui ) {
if(event.target.id =="slider1"){
scope.hello = ui.value;
$("#slider2").slider({value:ui.value})
scope.goodbye = ui.value;
}else if(event.target.id == "slider2"){
//stuff that second slider does
}
scope.$apply();
}
});
}
};
});