我刚开始编写文档代码,并试图用grunt-ngdocs来记录我的专业应用程序。
我从以下https://github.com/m7r/grunt-ngdocs-example中克隆了一个工作示例
给出的示例缺少一个有文档的控制器,因此我在下面的代码中添加了自己的文档控制器:
/**
* @ngdoc controller
* @name rfx.controller:testCtrl
* @description
* Description of controller.
*/
.controller('testCtrl', function() {
});当我试图通过从命令行运行grunt来构建文档时,我会得到以下错误消息:
Warning: Don't know how to format @ngdoc: controller Use --force to continue.我该怎么解决这个问题?我阅读了这个指南http://www.shristitechlabs.com/adding-automatic-documentation-for-angularjs-apps/,我不知道为什么我总是收到错误信息,如果我试图记录一个控制器:(谢谢您的帮助!
发布于 2015-12-15 22:06:54
发布于 2016-01-11 11:41:14
下面是如何记录示例控制器的方法:
/**
* @ngdoc function
* @name appModernizationApp.controller:DetailsCtrl
* @description
* # DetailsCtrl
* Controller of the appModernizationApp
* This controller is responsible for showing the details of the page.
* It gets initialized by requesting the JSON for types of rooms which is hosted on the server.
* It also requests for the details of the room for an existing reservation if the reservation id is present in the route using <b>HRS.getRegisteredData(reservationId)</b>.
* @requires $scope
* @requires $http
* @requires HRS
* @requires $location
* @requires $routeParams
* @requires breadcrumbs
* @requires UtilitiesService
*
* @property {object} breadcrumbs:object breadcrumbs Handles the page level/navigation at the top.
* @property {array} reservationDetails:array This holds the reservation details of the current/selected reservation.
* @property {string} registerationErrorMsg:string This variable holds the error message for all registration services.
* @property {string} roomSearchErrorMsg:string This variable holds the error message for all room search services.
* @property {array} roomDetails:array This holds the room details object. This will be a fresh object coming from service response and will be manipulated as per the view model.
* @property {boolean} submitted:boolean Holds the submitted boolean flag. Initialized with false. Changes to true when we store the details.
* @property {number} reservationId:number Gets the reservation id from the route params.
* @property {date} minDate:date Date filled in the minimum date vatiable
* @property {boolean} isRoomDetailsVisible:boolean Controls the boolean flag for visibility of room details. Initialized with false.
* @property {array} roomTypes:array Holds types of rooms from JSON.
* @property {array} expirymonth:array Months from Jan to Dec
* @property {array} expiryYear:array Years of a particular range
* @property {array} cardtype:array Type of cards
*/发布于 2017-10-23 08:49:42
使用德根尼并添加自定义控制器模板:
controller.template.html在config/template/ngdoc/api中创建{% extends "api/object.template.html" %} (它将继承对象模板,但您可以编写自己的模板)idTemplates中扩展computeIdsProcessor
配置(computeIdsProcessor) {computeIdsProcessor.idTemplates.find (idTempl) {返回idTempl.idTemplate ===“模块:${idTempl}.${docType}:${name}”;}).docTypes.push(“控制器”);})"controller"中包括computePathsProcessor
'partials/${area}/${module}/${docType}/${name}.html‘(computePathsProcessor) { computePathsProcessor.pathTemplates.push({ docTypes:'provider’、‘服务’、‘指令’、‘输入’、'object‘、'function’、'filter‘、'type’、‘控制器’、pathTemplate:‘${area}/${/${docType}/${name}’、outputPathTemplate: outputPathTemplate });})https://stackoverflow.com/questions/34299037
复制相似问题