Created
October 7, 2015 05:11
-
-
Save tkc/80f0242a7bba350138d7 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
<select | |
ng-model="selectedMonth" | |
ng-change="select()" | |
ng-options="month as month.label for month in months"></select> | |
<input type="hidden" name="test" value="@{{selectedMonth.num}}"> | |
@{{selectedMonth.label | json}} | |
var months = [ | |
{num: 1, label: "January"}, | |
{num: 2, label: "February"}, | |
{num: 3, label: "March"}, | |
{num: 4, label: "April"}, | |
{num: 5, label: "May"}, | |
{num: 6, label: "June"}, | |
{num: 7, label: "July"}, | |
{num: 8, label: "August"}, | |
{num: 9, label: "September"}, | |
{num: 10, label: "October"}, | |
{num: 11, label: "November"}, | |
{num: 12, label: "December"} | |
]; | |
var selectValue = 6; | |
$scope.months = months; | |
$scope.selectedMonth = months[0]; | |
_.each(months, function (v, k) { | |
if (v.num == selectValue) { | |
$scope.selectedMonth = $scope.months[2]; | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment