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

Commit

Permalink
Merge pull request #50 from dnwhte/Issue-49
Browse files Browse the repository at this point in the history
Deep copy non-primitive types before assigning to prop.value on editormodel
  • Loading branch information
mattbrailsford authored Mar 13, 2019
2 parents ef46774 + cc16c58 commit 3aa17ff
Showing 1 changed file with 5 additions and 1 deletion.
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

0 comments on commit 3aa17ff

Please sign in to comment.