如何使用ngDoc来记录一个常量?我没有看到任何特定于angular的文档来记录注册到.constant的值,而且常量的jsDoc语法在通过ngDoc运行时似乎不会生成任何实际的文档。
例如:
/** * @constant * @name WHITE * * @description * The color white! **/ module.constant( 'WHITE', '#fff' );
发布于 2015-03-19 22:32:54
ngDocs目前不提供记录常量的方法。正如您在其templating source code中所看到的。没有相应的html_usage_*方法。
我像这样记录常量,它将APP_CONFIG显示为一个模块。
/**
* @ngdoc object
* @name APP_CONFIG
* @description
* constant...
* @example
* APP_CONFIG is injectable as constant (as a service even to .config())
* <pre>
* (...) .config(function ($APP_CONFIG) {
* </pre>
*/发布于 2014-08-06 23:14:12
它应该是@const
/** @const */ var MY_BEER = 'stout';
/**
* My namespace's favorite kind of beer.
* @const {string}
*/
mynamespace.MY_BEER = 'stout';
/** @const */ MyClass.MY_BEER = 'stout';
/**
* Initializes the request.
* @const
*/
mynamespace.Request.prototype.initialize = function() {
// This method cannot be overridden in a subclass.
};有关详细信息,请参阅常量部分http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml#Constants和注释部分http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Comments#Comments
https://stackoverflow.com/questions/25163860
复制相似问题