chieffancypants / angular-hotkeys

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

How to generate $id of scope in boundScopes #252

Open lovelylip opened 7 years ago

lovelylip commented 7 years ago
    if (!(scope.$id in boundScopes)) {

      // Add the scope to the list of bound scopes
      boundScopes[scope.$id] = [];

      scope.$on('$destroy', function () {
        var i = boundScopes[scope.$id].length;
        while (i--) {
          _del(boundScopes[scope.$id].pop());
        }
      });
    }

how boundScopes generate $id for scope?, if i use action: 'keyup' or 'keydown', boundScopes not del old hotkeys

aramando commented 7 years ago

The $id property is added by Angular when a scope is constructed, and is unique to each scope within the lifecycle of the application; see here. I doubt it's the cause of the issue.