Skip to content

Instantly share code, notes, and snippets.

@sitefinitySDK
Created February 26, 2018 14:34
SF_10.2, SF_11.0, SF_11.1, SF_11.2, SF_12.0, SF_12.1, SF_12.2, SF_13.0, SF_13.1, SF_13.2, SF_13.3, SF_14.0, SF_14.1, SF_14.2, SF_14.3 - https://docs.sitefinity.com/feather-create-custom-designer-views
If you are persisting an object from the AngularJs scope to an MVC controller property, you need to stringify the response using the JSON.stringify function:
// watch the value of the scope variable and change the value in the MVC controller when it is changed.
$scope.$watch('scopeVariableName', function (newValue, oldValue) {
if (newValue) {
// Serialize the JavaScript object into a string before assigning it to the MVC Controller string property.
$scope.properties.PropName.PropertyValue = JSON.stringify(newValue);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment