diff --git a/modules/Object.js b/modules/Object.js index 5942cf4..f18ebb0 100644 --- a/modules/Object.js +++ b/modules/Object.js @@ -3,8 +3,8 @@ var module = angular.module('App'); module.factory('BaseObject', () => { class BaseObject { - constructor(data) { - Object.assign(this, data); + constructor(...datas) { + Object.assign(this, ...datas); } /** @@ -40,11 +40,11 @@ module.factory('BaseObject', () => { /** * Make a copy of object for use in forms - * + * * When you edit a record in a form, you want the original to be preserved while the user makes changes * This allows you to edit a record exactly as if you were creating one without having to worry about * rolling back changes to the object. - * + * * @note This makes a shallow copy only */ clone() { diff --git a/modules/Task/Task.js b/modules/Task/Task.js index 9020720..8796301 100644 --- a/modules/Task/Task.js +++ b/modules/Task/Task.js @@ -97,6 +97,10 @@ module.factory( 'Task', (BaseObject, $http) => { } + constructor(...datas) { + super({ done : false }, ...datas); + } + create() { return $http.post('/api/tasks', this) .then( (response) => {