Updated: Angularjs to v1.2.0 final.

Updated: Loading-bar to v0.0.5
Updated: Using the $promise of function to return promises instead of $q and callback function.
This commit is contained in:
Amritanshu
2013-11-12 00:29:23 +05:30
parent 4ace61cdee
commit d1a4fc1164
58 changed files with 4920 additions and 3164 deletions

View File

@ -1,6 +1,6 @@
'use strict';
var JournalCtrl = ['$scope', '$location', '$q', 'dateFilter', '$modal', 'voucher', 'Account', function ($scope, $location, $q, dateFilter, $modal, voucher, Account) {
var JournalCtrl = ['$scope', '$location', 'dateFilter', '$modal', 'voucher', 'Account', function ($scope, $location, dateFilter, $modal, voucher, Account) {
$('#txtAccount').focus();
$scope.voucher = voucher;
@ -151,34 +151,22 @@ var JournalCtrl = ['$scope', '$location', '$q', 'dateFilter', '$modal', 'voucher
};
$scope.accounts = function ($viewValue) {
var deferred = $q.defer();
Account.autocomplete({term: $viewValue, count: 20, a: true}, function (result) {
deferred.resolve(result);
});
return deferred.promise;
return Account.autocomplete({term: $viewValue, count: 20}).$promise;
};
}];
JournalCtrl.resolve = {
voucher: ['$q', '$route', 'Voucher', function ($q, $route, Voucher) {
var deferred = $q.defer();
voucher: ['$route', 'Voucher', function ($route, Voucher) {
var id = $route.current.params.id;
var successCb = function (result) {
deferred.resolve(result);
};
if (typeof id === 'undefined') {
Voucher.get({type: 'Journal'}, successCb);
return Voucher.get({type: 'Journal'}).$promise;
} else {
Voucher.get({id: id}, successCb);
return Voucher.get({id: id}).$promise;
}
return deferred.promise;
}]
};
var JournalModalCtrl = ['$scope', '$modalInstance', '$q', 'edit', 'Account', function ($scope, $modalInstance, $q, edit, Account) {
var JournalModalCtrl = ['$scope', '$modalInstance', 'edit', 'Account', function ($scope, $modalInstance, edit, Account) {
$scope.toggleDebit = function () {
$scope.edit.Debit = ($scope.edit.Debit === 1) ? -1 : 1;
};
@ -192,10 +180,6 @@ var JournalModalCtrl = ['$scope', '$modalInstance', '$q', 'edit', 'Account', fun
$modalInstance.dismiss('cancel');
};
$scope.accounts = function ($viewValue) {
var deferred = $q.defer();
Account.autocomplete({term: $viewValue, count: 20}, function (result) {
deferred.resolve(result);
});
return deferred.promise;
return Account.autocomplete({term: $viewValue, count: 20}).$promise;
};
}];