I'm having trouble formatting an object key to display months chronologically. I can't figure out what I'm doing wrong. Here's the code in the view:
<div ng-repeat="month in months | orderBy: 'english' | date: 'MMMM' ">
<h1><strong>{{ month.english }}</strong></h1>
<p><strong>French Word: </strong>{{ month.french }}</p>
<p><strong>Number of Days: </strong>{{ month.days }}</p>
<hr />
</div>
Here is a snippet of the object:
angular
.module('myApp', [])
.controller('myCtrl', function($scope) {
var months = [
{
english: 'August',
french: 'Aout',
days: 31,
ordinal: 8,
season: 'summer'
},
{
english: 'March',
french: 'Mars',
days: 31,
ordinal: 3,
season: 'spring'
},
{
english: 'February',
french: 'Fevrier',
days: 28,
ordinal: 2,
season: 'winter'
}
];
$scope.months = months;
});
Currently, it's sorting alphabetically and not by month. Any idea where I went off track?