SHARE
TWEET
Untitled
a guest
Oct 10th, 2016
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- angular.module('angularDemo.searchDirective',[])
- .directive('searchDirective', searchDirective);
- function searchDirective() {
- function link(scope, elem, attrs) {
- elem.bind("keydown keypress", function (event) {
- event.preventDefault();
- console.log(elem);
- console.log(attrs);
- scope.$apply(function (){
- scope.$eval(attrs.ngEnter);
- });
- });
- }
- return {
- restrict: 'E',
- scope: {
- tags: '=',
- onChange: '=',
- onPressEnter: '='
- },
- template: '<input type="text" ng-model="value" />',
- link: link
- };
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
