Fix a Bug on Editor Screen 37/31637/1
authorguangxingwang <gw1218@att.com>
Tue, 13 Feb 2018 19:25:42 +0000 (13:25 -0600)
committerguangxingwang <gw1218@att.com>
Tue, 13 Feb 2018 19:26:18 +0000 (13:26 -0600)
On editor screen, sometimes click on + button only one click, it creates
more than text fields

Issue-ID: POLICY-629
Change-Id: I9acc95fa0a4a7df3828e579f994c06bfa3199eb5
Signed-off-by: guangxingwang <gw1218@att.com>
POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DCAEMicroServicePolicyController.js

index 6f316c1..1013664 100644 (file)
@@ -438,6 +438,13 @@ angular.module('abs').controller('dcaeMicroServiceController', ['$scope', '$wind
                            }
                         //After initially create the edit template, reset it to false.
                            $scope.isInitEditTemplate = false;
+                           if($scope.temp.policy.editPolicy){
+                               //reset it to false since the template has been created
+                               $scope.temp.policy.editPolicy = false;
+                               //clean all the events of addNewChoice
+                               $scope.$on('$destroy', addNewChoice);
+                           }
+                           
                     }
                     var ele = angular.element(document.getElementById("DynamicTemplate"));
                        $compile(ele.contents())($scope);