SHARE
TWEET

Untitled

a guest Oct 11th, 2016 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. angular.module('angularDemo.searchDirective',[])
  2.   .directive('searchBar', searchDirective);
  3.  
  4. function searchDirective() {
  5.   function link(scope, elem, attrs) {
  6.     var callback = function(event){
  7.       console.log(event.target.value);
  8.     };
  9.     elem.bind("keydown keypress", _.debounce(callback, 300));
  10.   }
  11.  
  12.   return {
  13.     restrict: 'E',
  14.     transclude: true,
  15.     scope: {},
  16.     template: '<form class="form-inline"><div class="form-group"><div class="input-group"><input type="text" class="form-control" ng-model="value" ng-model-options="{ updateOn: \'blur\' }" ng-change="" id="searchText" placeholder="(e.g.: jQuery)" /></div></div></form>',
  17.     link: link
  18.   };
  19. }
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