chieffancypants / angular-hotkeys

Configuration-centric keyboard shortcuts for your Angular apps.
http://chieffancypants.github.io/angular-hotkeys/
MIT License
1.68k stars 248 forks source link

Error with cheat sheet template #172

Closed schamese closed 9 years ago

schamese commented 9 years ago

I get the following error when using the built in cheat sheet. (all those code lines point to internal angular code...)

TypeError: Cannot read property 'childNodes' of undefined
    at nodeLinkFn (external.min.js:16)
    at compositeLinkFn (external.min.js:15)
    at nodeLinkFn (external.min.js:16)
    at compositeLinkFn (external.min.js:15)
    at compositeLinkFn (external.min.js:15)
    at external.min.js:15
    at external.min.js:14
    at Scope.$get.Scope.$eval (external.min.js:17)
    at Scope.$get.Scope.$apply (external.min.js:17)
    at external.min.js:14

changing the template to omit the close button resolves this.

$hotkeysProvider.template = '<div class="cfp-hotkeys-container fade" ng-class="{in: helpVisible}" style="display: none;"><div class="cfp-hotkeys">' +
  '<h4 class="cfp-hotkeys-title" ng-if="!header">{{ title }}</h4>' +
  '<div ng-bind-html="header" ng-if="header"></div>' +
  '<table><tbody>' +
    '<tr ng-repeat="hotkey in hotkeys | filter:{ description: \'!$$undefined$$\' }">' +
      '<td class="cfp-hotkeys-keys">' +
        '<span ng-repeat="key in hotkey.format() track by $index" class="cfp-hotkeys-key">{{ key }}</span>' +
      '</td>' +
      '<td class="cfp-hotkeys-text">{{ hotkey.description }}</td>' +
    '</tr>' +
  '</tbody></table>' +
  '<div ng-bind-html="footer" ng-if="footer"></div>' +
  // WORKAROUND - this line causes the bug - why?
  //'<div class="cfp-hotkeys-close" ng-click="toggleCheatSheet()">×</div>' +
'</div></div>';

I have no idea why...

chieffancypants commented 9 years ago

Can you reproduce in a fiddler or something so I can take a look?

schamese commented 9 years ago

I tried to reproduce it, but with no success... I think it may be an internal angular problem, and not a problem with hotkeys, only something inside hotkeys that triggers it.

My Application on which the error occurred is pretty large and i miss the time to hang on this, so i think i will stay with my work around.

chieffancypants commented 9 years ago

Closing as this is not related to this project