Skip to content

Commit 3bb4a05

Browse files
author
Evan Gozali
committed
Fix bug when options.nameProperty=='name'
1 parent 51ef9fa commit 3bb4a05

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

angular-schema-form-dynamic-select.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,16 @@ angular.module('schemaForm').controller('dynamicSelectController', ['$scope', '$
189189
separator = newOptions.map.separatorValue ? newOptions.map.separatorValue : ' - ';
190190
data.forEach(function (current_row) {
191191
current_row["value"] = current_row[newOptions .map.valueProperty];
192-
current_row["name"] = ""; //init the 'name' property
193192
//check if the value passed is a string or not
194193
if(typeof newOptions.map.nameProperty != 'string'){
195194
//loop through the object/array
195+
var newName = "";
196196
for (var i in newOptions.map.nameProperty) {
197-
current_row["name"] += current_row[newOptions .map.nameProperty[i]];
198-
if(i != final){current_row["name"] += separator};
199-
}
200-
}
197+
newName += current_row[newOptions .map.nameProperty[i]];
198+
if(i != final){newName += separator};
199+
}
200+
current_row["name"] = newName; //init the 'name' property
201+
}
201202
else{
202203
//if it is a string
203204
current_row["name"] = current_row[newOptions .map.nameProperty];

0 commit comments

Comments
 (0)