Here is my controller:
angular.module('app', [])
.controller('ctrl', ['$scope', function ($scope) {
$scope.daysPerMonth = new Date(year, month).getDate();
}]
);
This is the corresponding html:
<div ng-app>
<h1>Calculate days in a month</h1>
<input ng-model="month" type="text" placeholder="Enter month as number">
<input ng-model="year" type="text" placeholder="Enter year as number">
<p ng-if="year" ng-model="daysPerMonth">
In {{ month }} of {{ year }}, there are {{ daysPerMonth }} days.
</p>
</div>
Can anyone help me figure out why it's not functioning correctly?