如何在文档中描述 angular 控制器方法?

How to describe angular controller methods in documentation?

我无法描述控制器方法。我该怎么做?

/**
* @ngdoc controller
* @name works.controller:worksCtrl
* @requires $http
* @requires $element
* @function
*
* @description
* Description for works controller. All methods will be writen later
*/
var worksCtrl = function ($http, $element) {

    var ctrl = this;

    //how it do there? this not work
    /** 
        * @name initializeGrid
        * @function
        * @description
        * Description for initializeGrid
    */
    ctrl.initializeGrid = function (a) {
       //...
    }

    ctrl.getTemplate = function (workIndex) {
      //...

    }
    //...
};

我正在使用 ngdoc 自动生成文档。但是我不明白我做错了什么。

我从未使用过 ngdoc,但查看 angular 代码本身,看起来您需要在内部函数的文档中添加一个 @ngdoc method 标签。例如,在 $locationProvider:

里面
  /**
   * @ngdoc method
   * @name $locationProvider#hashPrefix
   * @description
   * @param {string=} prefix Prefix for hash part (containing path and search)
   * @returns {*} current value if used as getter or itself (chaining) if used as setter
   */
  this.hashPrefix = function(prefix) {
    if (isDefined(prefix)) {
      hashPrefix = prefix;
      return this;
    } else {
      return hashPrefix;
    }
  };

希望对您有所帮助。

/**
* @ngdoc function
* @name initializeGrid
* @methodOf works.controller:worksCtrl
* @description This method initialize auto grid system for works
* @private
*/

ctrl.initializeGrid = function () {
     ...
}

这就是我需要的。)