【问题标题】:How to link between modules from different sections如何在不同部分的模块之间链接
【发布时间】:2014-08-15 15:04:31
【问题描述】:

如下所示,我在 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) 中重复。

【问题讨论】:

    标签: javascript angularjs angularjs-directive documentation gruntjs


    【解决方案1】:

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

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

    非常感谢。

    【讨论】:

      【解决方案2】:

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

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

      注意您需要如何使用相对路径从应用程序文档获取到 api 文档

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-04-07
        • 1970-01-01
        • 1970-01-01
        • 2022-11-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多