标签: grunt-ngdocs

控制器的ngdoc文档

我是新来的代码文档,并试图用grunt-ngdocs记录我的角度应用程序.

我从以下网址克隆了一个工作示例:https://github.com/m7r/grunt-ngdocs-example

给定的示例缺少文档控制器,因此我使用以下代码添加了自己的文档控制器:

 /**
  * @ngdoc controller
  * @name rfx.controller:testCtrl
  * @description 
  * Description of controller.
  */
 .controller('testCtrl', function() {
 });
Run Code Online (Sandbox Code Playgroud)

当我尝试通过从命令行运行grunt来构建文档时,我收到以下错误消息:

Warning: Don't know how to format @ngdoc: controller Use --force to continue.
Run Code Online (Sandbox Code Playgroud)

我该如何解决?我阅读了本指南http://www.shristitechlabs.com/adding-automatic-documentation-for-angularjs-apps/,如果我尝试记录控制器,我无法弄清楚为什么我会不断收到错误消息:(谢谢任何帮助!

javascript documentation-generation angularjs ngdoc grunt-ngdocs

7
推荐指数
2
解决办法
2349
查看次数

AngularJs ngdocs:注释方法返回一个promise

我目前正在记录我的第一个真正的AngularJs应用程序,因为我正在使用ngdocs语法与grunt-ngdocs

我想知道是否有更好的方法来注释我的服务方法返回一个promise(所以你知道你应该附加.then()而不是访问return对象.

   * @returns {object} returns a promise
Run Code Online (Sandbox Code Playgroud)

完整的服务背景:

/**
 * @ngdoc service
 * @name appServices.Authentication
 * @requires $http
 * @description
 * Service used to authenticate request to an api. It injects a session parameter into each request if the token parameter is set.
 * (as a request param for a GET and as an extra body param for a POST)
 **/
module.factory('Authentication', ['$http', function ($http) {

    var token;

    /**
     * @ngdoc method
     * @name appServices.Authentication#login
     * @methodOf ng.service
     * …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs grunt-ngdocs

4
推荐指数
1
解决办法
850
查看次数

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

我正在尝试使用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>
 */
Run Code Online (Sandbox Code Playgroud)

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

以下是编译文档的链接:

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

2
推荐指数
1
解决办法
336
查看次数