gpt4 book ai didi

javascript - 如何用ngdocs描述一个提供函数集合的返回对象?

转载 作者:行者123 更新时间:2023-12-03 16:38:09 24 4
gpt4 key购买 nike

我正在尝试根据以下结构创建文档:

/**
* @ngdoc service
*
* @name module:resource
* @module module
* @ return {Object} The returned object
*/

angular.module('module').factory('resource', [
function () {
function Foo (param1) {
//Do something with param1
}

return {

Test: {
/**
* @ngdoc function
* @name resource#theTest
* @methodOf module:resource
*
* @description
* Search to see if a study exists with the given protocol identifier
* @param {Object} params The param
* @return {Object} A Promise
*/
theTest: function(param) {
return functionFoo (param);
},

/**
* @ngdoc function
* @name resource#theTest1
* @methodOf module:resource
*
* @description
* Search to see if a study exists with the given protocol identifier
* @param {Object} params The param
* @return {Object} A Promise
*/
theTest1: function(param) {
return functionFoo (param)
}
}
};
}
]);

我想在文档中说的是服务“资源”返回一个返回函数集合的对象,但我找不到使用 ngdocs 执行此操作的方法。是否支持?

谢谢

最佳答案

我认为您不能指定“函数映射”,唯一受支持的类型是函数、对象、字符串、数字...但是您可以改为在您的类(class)中添加描述,例如:

/*
* @description
* This class return 2 functions as describe below:
* ```js
* {
* theTest {Function} This function do (...)
* theTest1 {Function} This function do (...)
* };
* ```
*/
function Foo (param1) {

希望对你有帮助

关于javascript - 如何用ngdocs描述一个提供函数集合的返回对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24314373/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com