note.js

angular.module('homepage').
directive('note', function () {
	return {
		controller: 'noteController',
		restrict: 'E',
		replace: true,
		templateUrl: 'components/feature-components/note/note.html'
	};
}).
controller('noteController', function($scope, DateUtility, Server) {
	$scope.getNotesData = function (dateRange) {	
		Server.getNotesData(dateRange).success(function(result) {
			console.log(result);
			$scope.notes = result.documents;
		});
	};
	
	var currentMonthIndex = new Date().getMonth();

	$scope.choosen = {
		year: 2018,
		month: currentMonthIndex
	};

	$scope.getNotesData(DateUtility.
		getMonthDateRange(new Date($scope.choosen.year, currentMonthIndex, 1)));
});