2

我正在使用 ngDocs 以角度记录指令。文档和示例运行良好,但没有生成演示,因为指令所基于的主模块是在生成页面后声明的。所以我得到错误:“模块'主模块'不可用!”

这是我的主要模块:

define(['angular'], function(angular){
    var module = angular.module('app.directivesModule', []);
    return module;
});

here is my directive:

/**
 * @ngdoc directive
 * @name app.directivesModule:hello
 *
 *@example
 <example module="app.directive">
 <file name="index.html">
 <hello></hello>
 </file>
 </example>
**/

define('hello', ['directivesModule'], function(directivesModule){
    directivesModule.directive('hello', function(){
        restrict: 'E',
        scope: {},
        templateUrl: hello.html
        link: function(scope){
        }
     });
});

在生成示例演示之前,我必须添加什么才能使 angular 运行主模块?

我尝试使用@exports 标记导出主模块以在指令中使用,但它似乎不起作用,并且我得到了同样的错误。

4

0 回答 0