【问题标题】:How to use ngDoc comments for routeConfig如何为 routeConfig 使用 ngDoc 注释
【发布时间】:2015-05-01 07:54:18
【问题描述】:

我正在尝试使用 ngdocs 和 grunt 记录我的 Angular WebApp。我想知道有没有办法记录路由配置,因为我觉得我的 WebApp 路由系统相当复杂,需要在其文档部分引起注意。

无论如何我可以在控制器,工厂等级别上拥有它。

我可以把它放在下面的楼层吗:

/**
 * @ngdoc controller
 * @name shippingSolutionApp.controller:MainCtrl
 * @description
 * # MainCtrl
 * <strong>PAGE LEVEL CONTROLLER:</strong> This is a page level controller.
 * 
 * This is a empty controller of shippingSolutionApp. Any business logic to initiate the app must fall here when required.
 * 
 * This holds the initialization process for both the sub-child WebApps: Admin Dashboard and User Dashboard
 * @requires
 * $scope
 */

谢谢, Ankit

【问题讨论】:

    标签: javascript angularjs documentation ngdoc


    【解决方案1】:

    这样的事情能让你开始吗?

    这不是一个很好的答案,因为我还没有写过要为 @description 写什么,但希望这说明了一种开始使用 ngdocs 来记录有关路由的内容的方法。

    /**
     * @ngdoc overview
     * @name app.config:routes
     * @description
     *   Your description here.
     */
    angular
      .module('app')
      .config(['$routeProvider', '$locationProvider', config]);
    
    function config ($routeProvider, $locationProvider) {
      $routeProvider
        .when(
          templateUrl : 'app/example.view.html',
          controllerAs: 'example',
          controller  : 'ExampleController'
        )
        .otherwise({
          redirectTo: '/'
        });
    }
    

    【讨论】:

      猜你喜欢
      • 2017-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多