Angularjs多指令[gridsection,gridsection]要求模板:<div gridsection ="">

Cat*_*ish 4 javascript angularjs angularjs-directive

我收到错误:Multiple directives [gridsection, gridsection] asking for templateon : <div gridsection="">使用此代码.

我不知道我是如何使用嵌套指令或导致这种情况的原因.

HTML页面

<div gridsection ></div>
Run Code Online (Sandbox Code Playgroud)

指示

angular.module('web').directive('gridsection', function() {
    return {
        restrict: 'A',
        replace: false,

        scope: {
      patient: "=patient"
        },
        templateUrl: 'directive/section.html',
        link: function(scope, element, attrs, fn) {


        }
    };
});
Run Code Online (Sandbox Code Playgroud)

指令/ section.html

<div>
  here?
</div>
Run Code Online (Sandbox Code Playgroud)

ges*_*we1 14

您似乎在角度代码中多次声明网格部分.

  • 或者您可以将源脚本包括两次. (7认同)
  • 我认为你在两个地方都有这一行,angular.module('web').directive('gridsection',function(){}); (2认同)