javascript - Issues creating AngularJS documentation using JsDoc3 -
i have angularjs factory trying generate documentation using jsdoc. logic below:
(function (angular) { /** * @module factories * @memberof angular_module */ var factories = angular.module('factories'); /** * @class baseservice * @classdesc base object * @param {object} $rootscope root scope application. */ factories.factory('baseservice', ['$rootscope', function ($rootscope) { var baseobject = (function () { // prototype var baseprototype = { _construct: function (args) { }, publicmethod: function (args) { } }; // 'private' methods function initialise(args) { } function privatemethod(param) { } function setobjectproperties(o, properties) { (prop in properties) { if (properties.hasownproperty(prop)) { o[prop] = properties[prop]; } } } //----------------------------------------------- return { create: function (args, properties) { function obj() { } obj.prototype = baseprototype; var o = new obj(); setobjectproperties(o, properties); // call base object 'constructor' o._construct(args); return o; } }; })(); return { /** * @function create * @memberof! baseservice * @description creates new object */ create: function (args, properties) { return baseobject.create(args, properties); } }; } ]); /** * @class childservice * @classdesc child object * @extends baseservice */ factories.factory('childservice', ['baseservice', function (baseservice) { return baseservice.create({ 'someproperty': true }, { /** * @function childpublicmethod * @description child public method */ childpublicmethod: function () { return this.publicmethod(123); } }); }]); }(angular));
in file have:
/** * @namespace angular_module */
the problem having generate documentation baseservice.create method part of baseservice documentation. generate documentation childservice.childpublicmethod function in childservice section. nothing created baseservice.create, , documentation childservice.childpublicmethod added factories module. have tried using @lends , @alias, sorts of combinations of modules/class names part of @memberof line, nothing far has given me desired outcome. suggestions gratefully received.
the solution have come follows:
(function (angular) { /** * @namespace factories * @memberof angular_module */ var factories = angular.module('factories'); /** * @class baseservice * @classdesc base object * @param {object} $rootscope root scope application. * @memberof angular_module.factories */ factories.factory('baseservice', ['$rootscope', function ($rootscope) { var baseobject = (function () { // prototype var baseprototype = { _construct: function (config) { }, /** * @function publicmethod * @description creates new object * @memberof angular_module.factories.baseservice */ publicmethod: function (args) { } }; // 'private' methods function initialise(args) { } function privatemethod(param) { } function setobjectproperties(o, properties) { (prop in properties) { if (properties.hasownproperty(prop)) { o[prop] = properties[prop]; } } } //----------------------------------------------- return { create: function (args, properties) { function obj() { } obj.prototype = baseprototype; var o = new obj(); setobjectproperties(o, properties); // call base object 'constructor' o._construct(args); return o; } }; })(); return { /** * @function create * @description creates new object * @memberof angular_module.factories.baseservice */ create: function (args, properties) { return baseobject.create(args, properties); } }; } ]); /** * @class childservice * @classdesc child object * @memberof angular_module.factories * @extends angular_module.factories.baseservice */ factories.factory('childservice', ['baseservice', function (baseservice) { return baseservice.create({ 'someproperty': true }, { /** * @function childpublicmethod * @description child public method * @memberof childservice */ childpublicmethod: function () { return this.publicmethod(123); } }); }]); }(angular));
here's changes:
i replaced @module declaration 'factories' variable @namespace
i added @memberof angular_module.factories class declarations.
i prefaced values @extends , @memberof tags angular_module.factories.
really hope helps out.
Comments
Post a Comment