allenhwkim / angular-jsdoc

AngularJS Template/Plugin for JSDoc 3.
MIT License
148 stars 57 forks source link

$rootScope in @name create duplicate members #97

Open lcaprini opened 8 years ago

lcaprini commented 8 years ago

Hi, first of all thank you for your awesome plugin! I'm trying to add your specific tags in my jsDoc documentation, but I have a strange behaviour.

If I use $rootScope in @name tag before AngularJS run function, jsDoc automatically add all members founded in all source.

 * Foo Description
 *
 * @memberof Foo
 * @ngdoc Globals
 * @name $rootScope
 */
angular.module("Foo").run(["$rootScope", ..., function($rootScope, ...){ 
...

$rootScope.memberA = false;
$rootScope.memberB = {};

This is awesome and useful, but if there is a redefinition of a member in one of the source files jsDoc duplicate it in Foo members section.

Do you have an idea of I can exclude all redefinition of a member?

Thank you

reloaded commented 8 years ago

Can you post more code, specifically the code that you expect to not be redefined?

lcaprini commented 8 years ago

As you can see in my module run I have $rootScope.memberA = false and $rootScope.memberB = {}. After using jsdoc in my documentation page appears a Globals section with $rootScope item; inside this I have a the Members table with two rows:

Name Type Description
memberA
memberB

So, jsodc automatically detect memberA and memberB as @memberof $rootScope: it ok.

The problem occurs when I also have $rootScope.memberA = true in one controller (or service, ...); I'd like the docs remain as before, instead I have:

Name Type Description
memberA
memberA
memberB

Seems that angular-jsdoc (o jsDoc) doesn't check if a member is already defined and added to documentation.

Thank you

reloaded commented 8 years ago

Try to replace @name $rootscope with @alias $rootscope instead.

lcaprini commented 8 years ago

If I replace @name with @alias the item $rootScope disappear from Globals section.