-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Error message on directive namespace conflict #11775
Comments
Feel free to provide a PR for this. Otherwise we will try to get to it in 1.5. At the moment there is no link back from injectable components to their originating modules. |
Trying my hand at a PR #11793. Would love some feedback to make sure I'm taking this the right direction. A little iffy on the idea of passing the module to all the invoke queue. But I can't think of any other way to accomplish this. |
@kentcdodds Probably there could be other way to do this. I'm just not 100% sure if this is possible, cuz I'm fairly new to angular.js sources. I assume, that each directive is an object. If so, there could probably be a way to find module in which directive is defined by using object comparison. Even if this solution is not good in terms of performance, I think it could be quite okay during exception throwing. And again, it's only an assumption, so don't judge me strictly please :) As well I can provide pull request, if this solution is implementable and somebody will tell me which parts of it are not implemented at all. |
It would be better find a way to search the loaded modules for directives with a given name. |
That could be reasonably done. I've done this before (the list on the left is auto-generated based on the contents of the |
Yeah, I see that. But in your example you have root module hardcoded: var allTheThings = [];
_.each(angular.module('kcd').requires, function(submoduleName) {
allTheThings = _.union(allTheThings, getThings(angular.module(submoduleName)));
}); As from what I understand, in real application this information is available only on injector level. That's why from my point of view, the only way to achieve what we want is to make injector expose list of loaded modules here: https://github.com/angular/angular.js/blob/master/src/auto/injector.js#L838 Guys, am I heading in the right direction? Can I go on with that and create a pull request? |
@lugovsky if you have a solution that does not impact the runtime performance and is cleanly implemented then by all means make a pull request. |
Show module name if possible when multidir error happens. Closes angular#11775
Hey guys. I finally created a pull request for this issue. Please check it out and tell, does it look good enough for you. I will be happy to do any modifications |
Code cleanup as angular team suggested. Closes angular#11775
Show module name if possible when multidir error happens. Closes angular#11775
Show module name if possible when multidir error happens. Closes angular#11775
I got this error message today:
Took me a while to debug whats wrong with my
pagination
directive. Until I discovered another directive with the exact same namepagination
from ui.bootstrap. It wasn't obvious as I didn't includeui.boostrap
myself.If the error message would include the module name the directive came from, this had helped a lot. Something like:
Example code: http://plnkr.co/edit/Mgxutpvfr4ngqRD6fV1F?p=preview
Version: angular.js/1.4.0-rc.1
The text was updated successfully, but these errors were encountered: