Last active
April 24, 2016 16:03
-
-
Save vicatcu/a2b4534840d235c4f805a9f2b66c2e06 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form name="myForm"> | |
<label for="duration"> Duration: </label><br> | |
<select name="duration" ng-model="selectedDuration" ng-change="durationChange()"> | |
<option ng-repeat="(key, value) in durations" value="{{value}}" selected="{{isSelectedDurationOption(value)}}"> | |
{{key}} | |
</option> | |
</select> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$scope.durations = { | |
"15 minutes": 900, | |
"1 hour": 3600, | |
"8 hours": 28800, | |
"16 hours": 57600, | |
"24 hours": 86400 | |
}; | |
$scope.selectedDuration = 3600; | |
$scope.durationChange = function(){ | |
console.log("selection changed to " + $scope.selectedDuration); | |
}; | |
$scope.isSelectedDurationOption = function(value){ | |
if(value == $scope.selectedDuration){ | |
return 'selected'; | |
} | |
return 'false'; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment