Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.module.directive('defaultRowTemplate', function() {
  2.   return {
  3.     scope: {
  4.       rowValue: '=',
  5.       rowKey: '=',
  6.       edit: '&'
  7.     },
  8.     replace: true,
  9.     template: "<div class=\"col-sm-10\" >\n  <input type=\"text\" ng-disabled=\"rowKey == 'Id'\" class=\"form-control\" id=\"{{rowKey}}\" ng-value=\"rowValue\">\n</div>",
  10.     link: function($scope, $element, $attrs) {
  11.       return $('input', $element).keyup(function(e) {
  12.         if (e.which === 13) {
  13.           return $scope.edit()($scope.rowKey, $scope.rowValue);
  14.         }
  15.       });
  16.     }
  17.   };
  18. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement