Skip to content
This repository has been archived by the owner on Oct 8, 2019. It is now read-only.

Commit

Permalink
refactor(DeCoffee): convert is-valid directive to es6
Browse files Browse the repository at this point in the history
  • Loading branch information
jtormey committed Jan 19, 2016
1 parent 628b64b commit 728d5d1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion app/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ head
script(src='build/js/directives/virtual-keyboard.js')
script(src='build/js/directives/btc-picker.directive.js')
script(src='build/js/directives/focus-when.directive.js')
script(src='build/js/directives/is-valid.js')
script(src='build/js/directives/is-valid.directive.js')
script(src='build/js/directives/is-not-equal.directive.js')
script(src='build/js/directives/transform-currency.js')
script(src='build/js/directives/label-origin.js')
Expand Down
18 changes: 18 additions & 0 deletions assets/js/directives/is-valid.directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
angular
.module('walletApp')
.directive('isValid', isValid);

function isValid() {
const directive = {
restrict: 'A',
require: 'ngModel',
link: link
};
return directive;

function link(scope, elem, attrs, ctrl) {
ctrl.$viewChangeListeners.push(() => {
ctrl.$setValidity('isValid', scope.$eval(attrs.isValid));
});
}
}
9 changes: 0 additions & 9 deletions assets/js/directives/is-valid.js.coffee

This file was deleted.

0 comments on commit 728d5d1

Please sign in to comment.