Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I document an attribute should either be present or absent? #147

Open
csaftoiu opened this issue Nov 16, 2015 · 2 comments
Open

How do I document an attribute should either be present or absent? #147

csaftoiu opened this issue Nov 16, 2015 · 2 comments

Comments

@csaftoiu
Copy link

I want to create a directive which takes a parameter based on whether an attribute is present. That is:

<foo some-attr></foo>

Should do one thing, while:

<foo></foo>

Should do another thing. I know how to accomplish this in code.

The question is, how do I document this with ngdoc? Currently I have:

/**
 * @ngdoc directive
 * @name someModule.directive:foo
 * @restrict E
 * @param {boolean=} someAttr If present, will do something.
 */

However, when the documentation is generated with ngdocs, it looks like this:

Usage

as element:

<foo
     [some-attr="{boolean}"]>
</foo>

This doesn't really convey what I want, which would be something like:

Usage

as element:

<foo
     [some-attr]>
</foo>

Is there any way to make the generated documentation look like that?

@wingedfox
Copy link
Contributor

Hi,

Take a look at Dgeni-alive generator, it is based on the recent dgeni-packages and provides more features than ngdocs (demo).

@petebacondarwin
Copy link
Member

@csaftoiu can you just do the following?

@param [someAttr] If present, will do something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants