Sha256: e0c4b95e9ac4d53babb6d73020eb94753fb14680799300c99b9c32b9f8cf7d37

Contents?: true

Size: 354 Bytes

Versions: 1

Compression:

Stored size: 354 Bytes

Contents

angular.module('EssayApp.directives').directive "presence", [() ->
  restrict: 'A'
  scope: true
  require: "ngModel"
  link: (scope, element, attrs, ngModel) ->
    scope.$watch(attrs.presence, ()->
      ngModel.$validate()
    )

    ngModel.$validators.required = (value) ->
      pres = scope.$eval(attrs.presence)
      return !(!!pres && !value)
]

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/assets/javascripts/app/directives/presence.js.coffee