【问题标题】:grunt-ngdoc is not rendering examples for my ngdoc documentationgrunt-ngdoc 没有为我的 ngdoc 文档呈现示例
【发布时间】:2016-02-26 21:39:14
【问题描述】:

我正在尝试获取一个基本示例,以便在我的 Angular 项目中使用 ngDoc。

这是一个例子:

/**
 * @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 有什么问题?

【问题讨论】:

    标签: javascript angularjs ngdoc grunt-ngdocs


    【解决方案1】:

    尝试用模块属性替换示例标签中的名称属性

    /**
     * @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 添加这个模块的路径和指令

    【讨论】:

    • +1 非常感谢您回答这个问题。我自己不会想到这一点。我给你 100 额外的声望作为感谢礼物。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-04
    • 1970-01-01
    • 1970-01-01
    • 2014-09-29
    • 2014-12-01
    • 2015-06-09
    • 1970-01-01
    相关资源
    最近更新 更多