Updated: Loading-bar to v0.0.5 Updated: Using the $promise of function to return promises instead of $q and callback function.
24 lines
767 B
JavaScript
24 lines
767 B
JavaScript
'use strict';
|
|
|
|
var BalanceSheetCtrl = ['$scope', '$location', 'dateFilter', 'info', function ($scope, $location, dateFilter, info) {
|
|
$scope.info = info;
|
|
$scope.show = function () {
|
|
if (angular.isDate($scope.info.Date)) {
|
|
$scope.info.Date = dateFilter($scope.info.Date, 'dd-MMM-yyyy');
|
|
}
|
|
$location.path('/BalanceSheet/' + $scope.info.Date);
|
|
};
|
|
$('#txtStartDate').focus();
|
|
}];
|
|
|
|
BalanceSheetCtrl.resolve = {
|
|
info: ['$route', 'BalanceSheet', function ($route, BalanceSheet) {
|
|
var date = $route.current.params.date;
|
|
|
|
if (typeof date === 'undefined') {
|
|
return BalanceSheet.get({}).$promise;
|
|
} else {
|
|
return BalanceSheet.get({date:date}).$promise;
|
|
}
|
|
}]
|
|
}; |