angularjs - 无法构建 angularjs 文档(不知道如何格式化 @ngdoc : method)

标签 angularjs gruntjs

我有一个带有一些文档的服务,但是当我尝试使用 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));

我确定我错过了一些简单的东西......

最佳答案

这是我最终做的

(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));

这似乎做我想做的事……也许有一种不那么冗长的做事方式?

关于angularjs - 无法构建 angularjs 文档(不知道如何格式化 @ngdoc : method),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23617961/

相关文章:

php - 使用 php 的 Angular $http 服务未显示数据?

javascript - 格式化前端 AJAX 调用以进行错误处理的最佳方法是什么?

javascript - Angularjs 数据表 - rowCallback 事件

javascript - jshint 的 Bootstrap 和 grunt 问题

javascript - 处理 Jasmine 测试中的 javascript 错误

javascript - 如何使用 gruntjs 将 javascript 文件内联到 html 页面中

javascript - AngularJS 选择框中的默认静态 HTML 值

node.js - 如何将mean.js部署到生产环境?

requirejs - 一起配置Grunt,Jasmine和RequireJS

javascript - Angular : switch HTML depending on screen resolution