- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我目前正在记录我的第一个真正的 AngularJs 应用程序,因为我正在使用 ngdocs 语法和 grunt-ngdocs
我想知道是否有更好的方法来注释我的服务方法返回一个 promise (所以你知道你应该附加一个 .then() 而不是访问返回对象。
* @returns {object} returns a promise
服务的完整上下文:
/**
* @ngdoc service
* @name appServices.Authentication
* @requires $http
* @description
* Service used to authenticate request to an api. It injects a session parameter into each request if the token parameter is set.
* (as a request param for a GET and as an extra body param for a POST)
**/
module.factory('Authentication', ['$http', function ($http) {
var token;
/**
* @ngdoc method
* @name appServices.Authentication#login
* @methodOf ng.service
* @returns {object} returns a promise
*/
function login(email, password) {
return $http.post('/auth/login', {email: email, password: password})
.then(function (response) {
if (response.data.token) {
token = response.data.token;
}
});
}
function getToken() {
return token;
}
return {
login: login,
token: getToken,
};
}]);
最佳答案
你可以简单地写:
* @returns {Promise} returns a promise
关于javascript - AngularJs ngdocs : annotate that a method returns a promise,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31984953/
我正在尝试获取一个基本示例,以便在我的 Angular 项目中使用 ngDoc。 这是一个例子: /** * @ngdoc directive * @name ui.components.uiRe
有 2 个 grunt 插件用于为 Angularjs 应用程序生成文档。 https://www.npmjs.org/package/grunt-ngdoc https://www.npmjs.or
我在我的团队中为一个框架编写文档,我想添加提供者。 当我添加@ngdoc 提供程序时,它对我说: 不知道如何格式化 @ngdoc: provider 我查看了 ngRoute 的 Angular 模块
如何使用 ngDoc 记录一个常量?我没有看到任何 Angular 特定的文档来记录使用 .constant 注册的值,并且常量的 jsDoc 语法在通过 ngDoc 运行时似乎不会生成任何实际的文档
我最近开始在我的 Angular 应用程序中使用 ngdocs,并且我对如何明智地记录模块配置和运行 block 感到困惑。 我目前有这个: /** * @ngdoc overview * @na
我正在尝试设置 ngdocs对于我们公司的项目。作为初学者,我认为我应该为我们的指令之一设置一个示例。 我有 ngdocs 这样工作,它生成文档等等。我想知道的是,在使用 ngdocs 时应该如何为指
如何修改 grunt-ngDocs 生成的网站的外观模板? ? 最终目标是将生成的文档集成到网站中。 例如,我们要为每个主题显示以下选项卡 演示(专注于最终用户呈现) 代码(给开发者) 为此,我们需要
我正在编写一个 AngularJS 组件,我想知道将 ngdoc 注释添加到组件本身和 Controller 函数的正确方法是什么。 你有什么例子吗? 最佳答案 这里有一个例子: controller
我是代码文档的新手,并尝试使用 grunt-ngdocs 记录我的 Angular 应用程序。 我从以下位置克隆了一个工作示例:https://github.com/m7r/grunt-ngdocs-
我使用 grunt grunt-ngdocs 模块,这是创建文档的代码。 ngdocs: { all: app_files, scripts: ['an
我想将 ngdoc 文档添加到 Angular 服务中的函数声明中。如何在下面的示例中为 myFunction 执行此操作? 我认为我需要像 @closure、@functionOf 或 @funct
我正在尝试使用 ngdocs 和 grunt 记录我的 Angular WebApp。我想知道有没有一种方法可以记录路由配置,因为我觉得我的 WebApp 路由系统相当复杂,它的文档部分需要一些注意。
我正在使用 grunt-ngDocs 生成我的 API 文档.我在使用包含使用 ngAnimate 的动画的示例时遇到问题。我在脚本选项中包含了 angular-animate 脚本(根据 ngdoc
给定一个带有返回类的工厂的 Angular 应用程序,如下所示: angular.module('fooApp').factory('User', function(){ function U
我有一个带有一些文档的服务,但是当我尝试使用 grunt-ngdocs 构建文档时,它失败了: Warning: Don't know how to format @ngdoc: method Use
我想记录我正在处理的一个 Angular 项目。我尝试了 grunt-ngdocs。它看起来简单,配置更少,初始试验看起来不错且很有前途。但是我找不到关于其完整用法的好资源。该工具的有限文档令人困惑。
我目前正在记录我的第一个真正的 AngularJs 应用程序,因为我正在使用 ngdocs 语法和 grunt-ngdocs 我想知道是否有更好的方法来注释我的服务方法返回一个 promise (所以
我所有的 js 文件都有文档,我的文档存在于以下文件夹结构中: myapplication/js/controllers/samplecontroller.js myapplication/js/di
我正在尝试通过 grunt-ngdocs 创建 API 文档。部分已创建,但 index.html 没有正确的链接。 我的 gruntfile.js 中有: module.exports = func
我对 Angular 2 有一些经验,但我对框架还是比较陌生。环顾四周,我发现了一个叫做 ngdocs 的东西。这非常好,因为它会根据代码中的注释为您创建一种文档/wiki 区域。 (类似于 js 文
我是一名优秀的程序员,十分优秀!