Skip to content

Instantly share code, notes, and snippets.

@NikolayGalkin
Last active August 29, 2015 14:26
Show Gist options
  • Save NikolayGalkin/640a7fd2f8b4947765c4 to your computer and use it in GitHub Desktop.
Save NikolayGalkin/640a7fd2f8b4947765c4 to your computer and use it in GitHub Desktop.
var DepartmentsAddController = (function () {
function DepartmentsAddController(DepartmentService, $state) {
_classCallCheck(this, DepartmentsAddController);
this.DepartmentService = DepartmentService;
this.$state = $state;
this.data = {
title: '',
description: ''
};
}
_createClass(DepartmentsAddController, [{
key: 'onSubmit',
value: function onSubmit(isValid) {
var _this2 = this;
if (!isValid) {
return false;
}
this.DepartmentService.save(this.data).then(function () {
_this2.$state.go('app.departments');
})['catch'](function (err) {
_this2.isError = true;
_this2.error = err && err.message;
});
}
}]);
return DepartmentsAddController;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment