     $scope.$on 'form-cancel', (event, resource, attribute) ->
       popPanel($scope)
       notify_listeners($scope, 'wizard-canceled', resource) if $scope.panelStack.length == 0
-    
+
     $scope.$on 'wizard-cancel', (event, resource, attribute) ->
       popAllPanels($scope)
       notify_listeners($scope, 'wizard-canceled', resource) if $scope.panelStack.length == 0
 
     $scope.$on 'form-submit', (event, resource, attribute) ->
       if $scope.panelStack.length == 1
-        notify_listeners($scope, 'wizard-submited', resource) 
+        notify_listeners($scope, 'wizard-submited', resource)
         popPanel($scope) unless $scope.csWizardOptions['keep-first']
       else
         popPanel($scope)
-      
+
     $scope.$on 'form-error', (event, resource, attribute) ->
       # TODO: 422 Unprocessable entity is handeled by displaying validation errors
       # alert should only be shown for exceptional errors. Need better mechanism for that.


    $scope.resource_descriptor = (panel) ->
      if overriden_resource_descriptors[panel.resource.descriptor.type]
        return overriden_resource_descriptors[panel.resource.descriptor.type] 
      else
        descriptor = angular.copy(panel.resource.descriptor)
        overriden_resource_descriptors[panel.resource.descriptor.type] = descriptor

      $scope.csWizardOptions['form-class']

    # ===== COMPILE DOM WITH APPROPRIATE DIRECTIVE ========

    if $scope.panel.directive
      innerElement = angular.element(element[0])
      inputTemplate = """
