- clone.className += ' child_single'; //here cloned is single element
- document.getElementById("div."+value).appendChild(clone);
- plainAttributeKeys.push(''+value+'@'+addElement);
+ if($scope.temp.policy.editPolicy || $scope.temp.policy.readOnly){ //if it's view or edit
+ if($scope.temp.policy.ruleData[clone.id] || ($scope.temp.policy.editPolicy && !$scope.isInitEditTemplate)){ // Only append child if its value found in ruleData or edit mode
+ if($scope.temp.policy.ruleData[clone.id]){
+ clone.value = $scope.temp.policy.ruleData[clone.id];
+ }
+ clone.className += ' child_single'; //here cloned is single element
+ document.getElementById("div."+value).appendChild(clone);
+ plainAttributeKeys.push(''+value+'@'+addElement);
+ }
+ }else{ //not view or edit
+ clone.className += ' child_single'; //here cloned is single element
+ document.getElementById("div."+value).appendChild(clone);
+ plainAttributeKeys.push(''+value+'@'+addElement);
+ }