Commit 8925ff91 authored by Sean Hammond's avatar Sean Hammond

Rename viewModel -> vm

parent 47d9024d
...@@ -85,23 +85,22 @@ function isNew(annotation) { ...@@ -85,23 +85,22 @@ function isNew(annotation) {
} }
} }
/** Copy properties from viewModel into domainModel. /** Copy properties from vm into domainModel.
* *
* All top-level properties in viewModel will be copied into domainModel, * All top-level properties in vm will be copied into domainModel, overwriting
* overwriting any existing properties with the same keys in domainModel. * any existing properties with the same keys in domainModel.
* *
* Additionally, the `tags` property of viewModel - an array of objects * Additionally, the `tags` property of vm - an array of objects each with a
* each with a `text` string - will become a simple array of strings in * `text` string - will become a simple array of strings in domainModel.
* domainModel.
* *
* @param {object} domainModel The object to copy properties to * @param {object} domainModel The object to copy properties to
* @param {object} viewModel The object to copy properties from * @param {object} vm The object to copy properties from
* @returns undefined * @returns undefined
* *
*/ */
function updateDomainModel(domainModel, viewModel) { function updateDomainModel(domainModel, vm) {
angular.extend(domainModel, viewModel); angular.extend(domainModel, vm);
domainModel.tags = viewModel.tags.map(function(tag) { domainModel.tags = vm.tags.map(function(tag) {
return tag.text; return tag.text;
}); });
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment