cobuild-angular-stack
Version:
Base stack angular sass jade gulp
29 lines (23 loc) • 950 B
JavaScript
(function (module) {
AdminDiscountCategoriesAddController.$inject = ['$scope', '$state', '$stateParams','$translate', 'toastr', '$uibModalInstance', 'DiscountCategory'];
module.controller('AdminDiscountCategoriesAddController', AdminDiscountCategoriesAddController);
function AdminDiscountCategoriesAddController($scope, $state, $stateParams, $translate, toastr, $uibModalInstance, DiscountCategory) {
$scope.description = "";
$scope.create = function() {
DiscountCategory.create({
description: $scope.description
}).$promise.then(function(category) {
$translate('success-save-data').then(function(translation){
toastr.success(translation);
$uibModalInstance.close(category);
});
}, $scope.error).catch($scope.error);
}
$scope.error = function(err) {
toastr.error(err);
}
$scope.close = function() {
$uibModalInstance.dismiss('cancel');
}
}
})(angular.module('uniko.admin.discount'));