Sha256: d3d7eb3ce8338dccd7ed1fba92c0a05712d469e5eb48c667884780124809309e

Contents?: true

Size: 686 Bytes

Versions: 113

Compression:

Stored size: 686 Bytes

Contents

angular.module('NgChangeOnBlur', [])
  .directive 'ngChangeOnBlur', ($timeout)->
    restrict: 'A',
    require: 'ngModel',
    link: (scope, element, attributes, ngModelCtrl) ->
      return if (attributes.type == 'radio' || attributes.type == 'checkbox')
      callFunction = attributes.ngChangeOnBlur
      oldValue = null
      element.bind 'focus', ->
        scope.$apply ->
          oldValue = element.val()
      element.bind 'blur', (event) ->
        delay = if element.hasClass('autocomplete') then 300 else 0
        $timeout ->
          scope.$apply ->
            newValue = element.val()
            scope.$eval(callFunction) if (newValue != oldValue)
        , delay

Version data entries

113 entries across 113 versions & 1 rubygems

Version Path
material_raingular-0.6.16 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.15 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.14 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.13 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.12 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.11 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.10 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.9 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.8 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.7 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.6 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.5 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.4 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.3 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.2.3 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.2.2 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.2.1 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.2 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.1.1 lib/assets/javascripts/directives/ngchangeonblur.js.coffee
material_raingular-0.6.1 lib/assets/javascripts/directives/ngchangeonblur.js.coffee