code: function() {
                  var editMode = $scope.editMode;
                  if (angular.isUndefined(editMode) || (editMode === null)) return;
  
                  //Set completed for all steps to the value of editMode
                  angular.forEach($scope.steps, function (step) {
                      step.completed = editMode;
                  });
  
                  //If editMode is false, set ONLY ENABLED steps with index lower then completedIndex to completed
                  if (!editMode) {
                      var completedStepsIndex = $scope.currentStepNumber() - 1;
                      angular.forEach($scope.getEnabledSteps(), function(step, stepIndex) {
                          if(stepIndex < completedStepsIndex) {
                              step.completed = true;
                          }
                      });
                  }
              }
docs: update completed state for each step based on the editMode and current step number