Directive name should probably be either trimmed or angular should throw an exception, so a typo is easier to spot. Leading or following space is clearly an error.
In the following example the name is 'directiveName ' instead of 'directiveName':
https://jsfiddle.net/c2ztgdjr/
Maybe same rule should be applied to controllers, factories etc, although it's still possible to inject those with an extra space.
I would say we should throw. This would be an easy fix in the compiler, see https://github.com/angular/angular.js/blob/74eb17d7c8232f72f134bf2546f10fed7234d276/src/ng/compile.js#L800
Anyone fancy sending a PR with an associated test?
@pkozlowski-opensource Hey! Please check the PR for this issue. Thanks!
Be careful not to have an upper case character at the beginning of your component name.
Most helpful comment
Be careful not to have an upper case character at the beginning of your component name.