-
Notifications
You must be signed in to change notification settings - Fork 27.4k
feat($compile): throw error when directive name or factory fn is invalid #15057
Conversation
If we do this for directives, why not do the same for controllers, filters, services etc? I feel we are going to far trying to be helpful here. |
Is there a thing as too helpful? :D |
Absolutely 😛
Point taken 😄 |
I don't think it's a breaking change, as I can't see a use case for adding an "empty" directive. And functions should be detected regardless of which shape they are. I guess I was a bit worried because we had that issue with the constructor fns in compile, but this is something different. |
d35cbad
to
a73d514
Compare
I've relaxed the check for the factory, as we can't guarantee 100% that our isFunction detects the most exotic ways of defining a function. |
What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
feat
What is the current behavior? (You can also link to an open issue here)
when the directive name or factory fn is undefined, no error is thrown
What is the new behavior (if this is a feature change)?
better errors are thrown
Does this PR introduce a breaking change?
No. Although I'm not sure if isFunction will catch all exotic ways to define a function.
Please check if the PR fulfills these requirements
Other information:
Closes: #15056