Skip to content

Commit 2a9b57c

Browse files
committed
() now working ok for stand alone and new objects
1 parent d621c32 commit 2a9b57c

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/ModelCore.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
self.$dataset = []; //cleanup
135135
self.$parse(result);
136136

137-
137+
self.$fetch();
138138

139139
//This can be improved
140140
//This is when your server reply a LOT of items (probably because it does not support the GET /data/id HTTP/1.1)
@@ -253,16 +253,17 @@
253253

254254
for (var prop in now) {
255255
if (!prev || prev[prop] !== now[prop]) {
256-
if (typeof now[prop] == "object") {
256+
if (typeof now[prop] == "object" && now[prop] !== null && typeof prev[prop] !== "undefined") {
257257
var c = self.$diff(prev[prop], now[prop]);
258-
if (! self.isEmpty(c) ) // underscore
258+
259+
if (! ModelCore.isEmpty(c) ) // underscore
259260
changes[prop] = c;
260261
} else {
261262
changes[prop] = now[prop];
262263
}
263264
}
264265
}
265-
266+
266267
return changes;
267268
},
268269

@@ -339,6 +340,7 @@
339340

340341
for(field in self.$dataset[index].$toObject()) {
341342
self[field] = self.$dataset[index][field];
343+
self.__proto__[field] = self.$dataset[index][field];
342344
}
343345

344346
return self.$dataset[index];
@@ -405,6 +407,7 @@
405407
options.params = query;
406408

407409
options.headers = model.$settings.headers;
410+
options.withCredentials = true;
408411

409412
return $http(options);
410413
}
@@ -424,8 +427,6 @@
424427
offline = sessionStorage.getItem(_key);
425428
}
426429

427-
console.log(_key,offline)
428-
429430
offline = JSON.parse(offline);
430431

431432
//error
@@ -440,8 +441,6 @@
440441
deferred.reject('Error processing offline call: ' + data.toString() );
441442
}
442443

443-
console.log(deferred)
444-
445444
return deferred;
446445
}
447446

@@ -511,8 +510,6 @@
511510
angular.extend(self.prototype, props);
512511
}
513512

514-
//console.log(props,staticProps)
515-
516513
angular.extend(self, parent, original);
517514

518515

0 commit comments

Comments
 (0)