Created
March 19, 2018 15:17
-
-
Save mklickman/08ae7ca40cc53d90937482c3f3386840 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="zip-input-group" zip-input ng-submit="checkZip()"> | |
<input class="zip-input-text" name="zip-text" type="text" maxlength="5" required> | |
<input type="submit" value="Go!" class="zip-input-submit"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myApp') | |
.directive('zipInput', function() { | |
return { | |
restrict: "A", | |
scope: {}, | |
controller: [$scope, function zipInputController($scope) { | |
$scope.checkZip = function() { | |
console.log("ZIP form submitted!"); | |
} | |
}] | |
} | |
}); |
I haven't tried it, and that may work, but I'm not a huge fan of putting all my logic inside the link function, when the controller is specifically designed to handle all that. I'm more interested in why it's not working. Thanks for the suggestion though!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Have you tried using the link prop instead of controller?