Skip to content

Catch common typos on scope methods #352

@OverZealous

Description

@OverZealous

One of the more annoying typos that comes up is calling scope.watch instead of scope.$watch.

It would be nice to disallow calling any of the common scope methods on scope, $scope, or $rootScope without the appropriate $ prefix.

Only on these objects:

  • $scope
  • scope
  • $rootScope

These method names are invalid:

  • new
  • watch
  • watchGroup
  • watchCollection
  • digest
  • destroy
  • eval
  • evalAsync
  • apply
  • applyAsync
  • on
  • emit
  • broadcast

Similarly, it would be nice to error if someone types in scope.$on('destroy', ...) instead of scope.$on('$destroy', ...).

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions