I’m trying to set the default select value to a specific value:
var current_month = 2;
$scope.month = [{monthNo: 0, numDaysInMonth: 31, monthName: "January"},
{monthNo: 1, numDaysInMonth: 28, monthName:
"February"},
{monthNo: 2, numDaysInMonth: 31, monthName:
"March"},
{monthNo: 3, numDaysInMonth: 30, monthName:
"April"},
{monthNo: 4, numDaysInMonth: 31, monthName:
"May"},
{monthNo: 5, numDaysInMonth: 30, monthName:
"June"},
{monthNo: 6, numDaysInMonth: 31, monthName:
"July"},
{monthNo: 7, numDaysInMonth: 31, monthName:
"August"},
{monthNo: 8, numDaysInMonth: 30, monthName:
"September"},
{monthNo: 9, numDaysInMonth: 31, monthName:
"October"},
{monthNo: 10, numDaysInMonth: 30, monthName:
"November"},
{monthNo: 11, numDaysInMonth: 31, monthName:
"December"}];
How do I get my select to be set to month 2 (March). Have tried different
things but right now my html looks like this:
<select ng-model="selectedmonth"
ng-change="selectedMonthChanged({{m.monthNo}})">
<option ng-repeat="m in month"
value={{m.monthNo}}>{{m.monthName}}</option>
</select>
Thank you.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.