When I create a dropdown menu using ng-repeat
, my function fails if the JSON data is in string format, but works fine with integers.
As you can observe, the chart uploads successfully with the year selected from the dropdown as an integer value, like "year": 2011
However, when it comes to the quarter dropdown, having "quarter": "1"
causes issues with updating, while "quarter": 2
functions properly.
<select class="YearSelector" ng-model="selectedyear" ng-change="sampleDropDown()">
<option ng-repeat="year in filterOptions.stores | unique: 'year'">
{{ year.year }}</option>
</select>
Quarter:
<select class="QuarterSelector" ng-model="$parent.quarter" ng-change="sampleDropDown()">
<option ng-repeat="quarter in filterOptions.stores | unique: 'quarter'">
{{ quarter.quarter }}</option>
</select>
My function:
$scope.sampleDropDown = function(){
myChart.data = getData(data, $scope.selectedyear, $scope.quarter);
myChart.draw(500);
}