UNPKG

acha-framework

Version:

is a modular framework on both client (angular.js) and server (node.js) side, it provides security, orm, ioc, obfuscation and ...

29 lines 826 B
(function (angular, undefined) { 'use strict'; angular.module('frontend.library').factory('operationResult', function () { var OperationResult = function () { this.error = null; this.status = false; this.data = null; }; OperationResult.success = function (data) { return new OperationResult().success(data); }; OperationResult.failed = function (error) { return new OperationResult().failed(error); }; OperationResult.prototype.success = function (data) { this.data = data; this.status = true; this.error = null; return this; }; OperationResult.prototype.failed = function (error) { this.data = null; this.status = false; this.error = error; return this; }; return OperationResult; }); }(angular));