mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 09:41:27 +00:00
42c63dd5a2
http://blog.brunoscopelliti.com/angularjs-directive-to-check-that-passwords-match the old one from SO does not seem to work any more
15 lines
No EOL
324 B
CoffeeScript
15 lines
No EOL
324 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
|
|
App.directive "equals", [->
|
|
return {
|
|
require: "ngModel"
|
|
link: (scope, elem, attrs, ctrl) ->
|
|
firstField = "#" + attrs.equals
|
|
elem.add(firstField).on "keyup", ->
|
|
scope.$apply ->
|
|
equal = elem.val() == $(firstField).val()
|
|
ctrl.$setValidity "areEqual", equal
|
|
}
|
|
] |