标签: ngdoc

如何为Angular组件注释ngdoc?

我正在编写一个AngularJS组件,我想知道将ngdoc注释添加到组件本身和控制器功能的正确方法是什么.

你有什么例子吗?

javascript angularjs ngdoc angular-components

13
推荐指数
1
解决办法
1359
查看次数

如何使用ngdoc记录以角度返回类的工厂?

给定一个带有返回类的工厂的角度应用程序,如下:

angular.module('fooApp').factory('User', function(){
    function User(name){
        this.name = name;
    }

    User.prototype.greet = function(){
        return "Howdy, " + this.name;
    }

    return User;
});
Run Code Online (Sandbox Code Playgroud)

使用ngdoc(jsdoc角度使用的特殊风格),如何在不将其定义为方法的情况下记录初始化程序?

现在,这是我尝试过的:

/**
 * @ngdoc service
 * @name fooApp.User
 * @description User factory.
 */

angular.module('fooApp').factory('User', function(){

    /**
     * @ngdoc method
     * @methodOf fooApp.User
     * @name Initializer
     * @description Initializes a new User object with a name
     */
    function User(name){
        this.name = name;
    }

    User.prototype.greet = function(){
        return "Howdy, " + this.name;
    }

    return User;
}); …
Run Code Online (Sandbox Code Playgroud)

javascript documentation jsdoc angularjs ngdoc

8
推荐指数
1
解决办法
4692
查看次数

控制器的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
查看次数

如何使用ngdoc来记录角度服务中的函数声明?

我想将ngdoc文档添加到角度服务中的函数声明中.我如何在下面的示例中为myFunction执行此操作?

我估计我需要像@closure,@ functionOf或@functionIn这样的东西.

请注意(与myMethod相反)myFunction不是一种方法.

/**
 * @ngdoc service
 * @name myApp.service:myService
 * @description
 *   My application.
 */
angular
  .module('myApp')
  .factory('myService', function() {
    'use strict';

    var x = 0;

    /**
     * @ngdoc function
     * @name ?
     * @description
     *   How can this be identified as being within the closure of 
     *   myService, and not be described as a constructor?
     */
    function myFunction (z) {
      x++;
      x += z;
    }

    return {
      /**
       * @ngdoc method
       * @name myMethod
       * @methodOf myApp.service:myService …
Run Code Online (Sandbox Code Playgroud)

documentation angularjs ngdoc

6
推荐指数
1
解决办法
4308
查看次数

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
查看次数