gpt4 book ai didi

angularjs - ngdocs - 如何记录模块配置和运行 block

转载 作者:行者123 更新时间:2023-12-02 11:26:26 25 4
gpt4 key购买 nike

我最近开始在我的 Angular 应用程序中使用 ngdocs,并且我对如何明智地记录模块配置和运行 block 感到困惑。

我目前有这个:

/**
* @ngdoc overview
* @name app.core
* @description
* # app.core
* This module defines the core application behaviour such as routing and translation services.
*/
angular.module('app.core', ['pascalprecht.translate',
'ui.router'
])
.run(['$rootScope', '$state', 'AuthService', function($rootScope, $state, AuthService){
//How to document this?
$rootScope.$on('$stateChangeStart', function(event, toState, toParams){
if(toState.name !== 'login' && !AuthService.isLoggedIn()){
var requestedState = {
toState: toState,
toParams: toParams
};
$state.go('login', requestedState);
event.preventDefault();
}
});
}]);

这将按预期输出文档中的模块 app.core。但是我如何记录运行 block 呢?我正在努力寻找任何例子。

谢谢

最佳答案

尝试修改@name,即:

* @name app.core.run:AuthService

附注:我一直在寻找更好的 @ngdoc 类型。如果我们可以使用 @ngdoc config@ngdoc run,我会更喜欢它,但到目前为止我还没有发现这些是有效的类型。

关于angularjs - ngdocs - 如何记录模块配置和运行 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34546208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com