如何在不同部分的模块之间进行链接

How to link between modules from different sections

本文关键字:之间 模块 链接 同部      更新时间:2023-09-26

如下所示,我在Grunfile.js的ngdocs设置中定义了两个部分:

ngdocs: {
  options: {
    dest: 'docs',
    html5Mode: false,
    ....
  },
  api: {
    src: ['src/lib/*.js'],
    title: 'Libraries'
  },
  app: {
    src: ['src/app/*.js'],
    title: 'Application'
  }
},

如何通过@link指令连接这些模块?如果你构建这个例子,你会看到src/app/main.js模块(MainModule)到src/lib/notification.js模块(NotificationsModule)之间的所有链接都被破坏了:(

此问题已从项目问题#98 (https://github.com/m7r/grunt-ngdocs/issues/98)中重复出现。

添加模块名作为前缀解决问题!这意味着

/**
 * @ngdoc function
 * @name MainModule.NotifyCtrl
 * @requires $scope
 * @requires api/NotifyModule.NotificationsService

谢谢。

我不确定我是否正确理解了你的问题,但是当我为我的服务编写文档时,我发现要链接到文档的其他部分的文档,需要使用这种格式:

@ngdoc service
@name app.module.servicename
@requires app.module.anotherService
@requires app.module2.anotherServiceInApp
@requires ./api/api.serviceModule.serviceInApiModule

注意你需要使用相对路径从应用文档到API文档