I pass the index value $ ng-click for my controller and then use its value in ng-repeat for my data from the array, but I get the error "ReferenceError: myChoice not defined"
In my view (months.html) there is a list of all months, when it is selected, it passes the value to the controller.
<ion-list ng-repeat="time in times.months" ng-click="getMonthId($index)" style="">
<ion-item style="" href="#/dmtimes">{{ time.monthId }} - {{ time.MonthName }</ion-item>
</ion-list>
The view output shows:
1 - Jan
2 - Feb
3 - Mar
etc
My controller has the following extraction code:
.controller('dailyMeetingTimesCtrl', function($scope, MeetingNames, $ionicLoading, $firebase, $firebaseArray) {
$scope.getMonthId = function (monthId) {
alert("you selected: " + monthId);
$scope.myChoice = monthId;
console.log(myChoice);
}
})
In my second view (displayMeetingTimes.html) I want to display meeting details, time, etc. for the selected month. The code is as follows:
<ion-view title="Daily Meeting Times">
<ion-content ng-controller="dailyMeetingTimesCtrl" class="has-header" overflow-scroll="true" padding="true">
<ion-list>
<ion-item ng-repeat="time in times.months(myChoice).days" class="item-text-wrap">
<span>{{myChoice}}</span>
Meeting Name: {{ time.meetingName }}<br />
Star Time: {{ time.startTime }}<br />
Finish Time: {{ time.finishTime }}<br />
</ion-item>
</ion-list>
</ion-content>
</ion-view>
, "myChoice" , "ReferenceError: myChoice "
, , ? .