 
                 if isBackspace(event)
                   # get the string before the selection and figure out how many commas it has
-                  originalCursorPosition = elem[0].selectionStart
+                  originalCursorPosition = elem[0].selectionEnd
                   stringAfterCursor = elem.val().slice(originalCursorPosition, elem.val().length)
                   elem.val resetCommas(stringAfterCursor) # reformat the number in place
 


                  # trigger final change event
                  triggerChange(elem)

              else



    isBackspace = (event)->
      event.which == 8

    isLetterA = (event)->
      event.which == 65

    getOptions = (scope, attrs) ->
        options = angular.copy defaultOptions
