Tôi muốn thêm tài liệu ngdoc vào khai báo hàm trong một dịch vụ góc. Làm thế nào tôi có thể làm điều này cho myFunction trong ví dụ dưới đây?Làm thế nào ngdoc có thể được sử dụng để ghi lại một khai báo hàm trong một dịch vụ góc?
Tôi cho rằng tôi cần một cái gì đó như @closure, @functionOf hoặc @functionIn.
Xin lưu ý rằng (trái ngược với myMethod) myFunction không phải là phương pháp.
/**
* @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
* @description
* A method of myService.
*/
myMethod : function (x) {
myFunction(x);
}
};
})
tôi tìm thấy tài liệu cho ngdocs đây: https://github.com/idanush/ngdocs/wiki/API-Docs-Syntax – paulhhowells
và ở đây: https://github.com/angular /angular.js/wiki/Writing-AngularJS-Documentation – paulhhowells