grunt-ngdoc没有为我的ngdoc文档呈现示例

时间:2015-10-29 14:37:04

标签: javascript angularjs ngdoc grunt-ngdocs

我正在尝试使用ngDoc为我的Angular项目提供一个基本示例。

以下是一个例子:

/**
 * @ngdoc directive
 * @name ui.components.uiRepeat
 * @description
 *
 * Place this attribute directive on any element that has an `ng-repeat` on it, and it will add CSS classes
 * for the different element states in the repeat set.
 *
 * @example
 <example name="uiRepeat-directive">
 <file name="index.html">
 <div ng-repeat="item in items" ui-repeat="item">
 </div>
 </file>
 </example>
 */

编译文档时,会显示示例标题,但没有嵌入示例。

以下是编译文档的链接:

http://thinkingmedia.github.io/thinkingmedia-ui/#/api/ui.components.uiRepeat

这是Angular文档的链接,显示了一个示例:

https://docs.angularjs.org/api/ng/directive/ngClick

我的ngDoc不能有什么问题吗?

1 个答案:

答案 0 :(得分:5)

尝试按模块属性

替换example标记中的name属性
/**
 * @ngdoc directive
 * @name ui.components.uiRepeat
 * @description
 *
 * Place this attribute directive on any element that has an `ng-repeat` on it, and it will add CSS classes
 * for the different element states in the repeat set.
 *
 * @example
 <example module="ui">
 <file name="index.html">
 <div ng-repeat="item in items" ui-repeat="item">
 </div>
 </file>
 </example>
 */

并且不要忘记将此模块和指令添加到您的Gruntfile