Sha256: 02c5b7af1415269d7c7b4488bb9f171a4345c1cf73ce0f3427fd5f45845a29a5
Contents?: true
Size: 1.17 KB
Versions: 32
Compression:
Stored size: 1.17 KB
Contents
!(angular => { 'use strict'; function StandardModelImports(DirtyAwareModel, ActionHandler) { return class StandardModel extends DirtyAwareModel { constructor(name, resource, newItem, dirtyAwareFields, dirtyAwareComparators) { super(resource, dirtyAwareFields, dirtyAwareComparators); this._handler = new ActionHandler(name, { modelItem: () => this.item }); this._newItemObj = newItem; } fetch(params) { return this._handler.wrapFetch(super.fetch.bind(this, params)); } destroy() { return this._handler.wrapDestroy(super.destroy.bind(this)); } update(params) { return this._handler.wrapUpdate(super.update.bind(this, params)); } create(params) { return this._handler.wrapCreate(super.create.bind(this, params)); } _newItem() { // must ensure this method returns a fresh new object each time return angular.copy(this._newItemObj); } }; } StandardModelImports.$inject = ['DirtyAwareModel', 'ActionHandler']; angular.module('modelGeneration.standardModel', ['models']).service('StandardModel', StandardModelImports); }(angular));
Version data entries
32 entries across 16 versions & 1 rubygems