我有一个带有一些文档的服务,但是当我尝试使用grunt-ngdocs构建文档时,它会失败:
Warning: Don't know how to format @ngdoc: method Use --force to continue.这就是我想要做的
(function(angular) {
'use strict';
angular.module('services.base64', [])
.factory(
'Base64',
[function() {
/**
* @ngdoc service
* @name Base64
* @module services.base64
* @description Provides encoding a string into base64, and decode base64 to a string
*/
return {
/**
* @ngdoc method
* @name Base64#encode
* @param {string}
* input the string you want to encode as base64
* @returns {string} the base64 encoded string
*/
encode : function(input) {
//...
},
/**
* @ngdoc method
* @name Base64#decode
* @param {string}
* input the base64 encoded string
* @returns {string} the decoded string
*/
decode : function(input) {
//...
}
};
}]);
}(angular));我肯定我错过了一些简单的东西..。
发布于 2014-05-23 18:49:53
以下是我最后所做的
(function(angular) {
'use strict';
/**
* @ngdoc overview
* @name services.base64
*/
angular.module('services.base64', [])
.factory(
'Base64',
[function() {
/**
* @ngdoc service
* @name services.base64.Base64
* @description Provides encoding a string into base64, and decode base64 to a string
*/
return {
/**
* @ngdoc method
* @name encode
* @methodOf services.base64.Base64
* @param {string}
* input the string you want to encode as base64
* @returns {string} the base64 encoded string
*/
encode : function(input) {
//...
},
/**
* @ngdoc method
* @name decode
* @methodOf services.base64.Base64
* @param {string}
* input the base64 encoded string
* @returns {string} the decoded string
*/
decode : function(input) {
//...
}
};
}]);
}(angular));这似乎是我所做的
发布于 2014-08-25 19:08:44
问题正在发生,因为您需要给您的方法一个适当的父(服务、对象等)。因为您试图在函数返回语句上设置父services.base64.Base64,所以没有正确设置它。一旦将注释块移动到函数中,它就能够被正确地解释为方法父级,并随后工作。
https://stackoverflow.com/questions/23617961
复制相似问题