SHARE
TWEET

Untitled

a guest Oct 4th, 2016 27 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function yourDirective() {
  2.     return {
  3.         restrict: 'A',
  4.         require: 'ngModel',
  5.         link: function (scope, element, attrs, ngModelCtrl) {
  6.  
  7.             ngModelCtrl.$parsers.push(function (viewValue) {
  8.                 // code to parse the view
  9.                 return _requirement; // return the model
  10.             });
  11.  
  12.             ngModelCtrl.$formatters.push(function (modelValue) {
  13.                 // code to format the model
  14.                 return _viewValue; // return the view
  15.             });
  16.         }
  17.     };
  18. }
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