Skip to content
This repository has been archived by the owner on Dec 13, 2021. It is now read-only.

Deep copy non-primitive types before assigning to prop.value on editormodel #50

Merged
merged 1 commit into from
Mar 13, 2019
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,10 @@ angular.module("umbraco").factory("innerContentService", [
}
};

var isPrimitive = function (test) {
return (test !== Object(test));
};

self.populateName = function (itm, idx, contentTypes) {

var contentType = _.find(contentTypes, function (itm2) {
Expand Down Expand Up @@ -532,7 +536,7 @@ angular.module("umbraco").factory("innerContentService", [
for (var p = 0; p < tab.properties.length; p++) {
var prop = tab.properties[p];
if (dbModel.hasOwnProperty(prop.alias)) {
prop.value = dbModel[prop.alias];
prop.value = isPrimitive(dbModel[prop.alias]) ? dbModel[prop.alias] : angular.copy(dbModel[prop.alias]);
}
}
}
Expand Down