Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions modules/Object.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 4 additions & 0 deletions modules/Task/Task.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ module.factory( 'Task', (BaseObject, $http) => {
}


constructor(...datas) {
super({ done : false }, ...datas);
}

create() {
return $http.post('/api/tasks', this)
.then( (response) => {
Expand Down