SHARE
TWEET

Untitled

a guest Oct 10th, 2016 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('angularDemo.searchDirective',[])
  2.   .directive('searchDirective', searchDirective);
  3.  
  4. function searchDirective() {
  5.   function link(scope, elem, attrs) {
  6.     elem.bind("keydown keypress", function (event) {
  7.       event.preventDefault();
  8.       console.log(elem);
  9.       console.log(attrs);
  10.       scope.$apply(function (){
  11.           scope.$eval(attrs.ngEnter);
  12.       });
  13.     });
  14.   }
  15.  
  16.   return {
  17.     restrict: 'E',
  18.     scope: {
  19.       tags: '=',
  20.       onChange: '=',
  21.       onPressEnter: '='
  22.     },
  23.     template: '<input type="text"  ng-model="value" />',
  24.     link: link
  25.   };
  26. }
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. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top