Javascript 文档angular.js应用程序与docular
我在记录我的应用程序时遇到了一些问题。我正在使用及其标记来记录我的模块 然而,当涉及到作为服务一部分的方法时,例如angular.js文档本身的标记与docular建议的不同 例如,在angularjs源代码中,您可以找到如下文档:Javascript 文档angular.js应用程序与docular,javascript,angularjs,documentation,Javascript,Angularjs,Documentation,我在记录我的应用程序时遇到了一些问题。我正在使用及其标记来记录我的模块 然而,当涉及到作为服务一部分的方法时,例如angular.js文档本身的标记与docular建议的不同 例如,在angularjs源代码中,您可以找到如下文档: /** * @ngdoc method * @name ng.$q#defer * @kind function * * @description * Creates a `Deferred` object which rep
/**
* @ngdoc method
* @name ng.$q#defer
* @kind function
*
* @description
* Creates a `Deferred` object which represents a task which will finish in the future.
*
* @returns {Deferred} Returns a new instance of deferred.
*/
查看@name
您会发现延迟
是ng.$q
模块的一种方法。但是当我将语法与hashtag#
一起使用时,它被解释为一个额外的模块,例如
/**
* @ngdoc service
* @name myApp.service:myService
* @description
* some description
*/
angular.module('myApp').service('myService', function() {
return {
/**
* @ngdoc method
* @name myApp.service:myService#fetch
* @description
* Some description
*/
fetch: function(forceUpdate) {
}
};
}]);
在文档myService\fetch
中变成。但是当像这样使用@methodOf
时,它是有效的:
/**
* @ngdoc service
* @name myApp.service:myService
* @description
* some description
*/
angular.module('myApp').service('myService', function() {
return {
/**
* @ngdoc method
* @name fetch
* @methodOf myApp.service:myService
* @description
* Some description
*/
fetch: function(forceUpdate) {
}
};
}]);
为什么会这样?这是记录我的服务的错误方式吗?为什么它在angular代码中工作?对我来说也是一样,只是即使使用@methodOf也不起作用,它将方法放在模块下,而不是服务下。