Multiple directives asking for templates on

后端 未结 13 1773
长情又很酷
长情又很酷 2021-01-07 18:18

I have the following HTML:

13条回答
  •  臣服心动
    2021-01-07 18:44

    Happened to me when I was having two components with the same name (copy paste error):

    For my coffeescript, but easy to happen in pure angular:

    component1.coffee
        appModule.component('name', {
        templateUrl: '/public/partials/html1.html',
      controller: 'controler1',
      bindings: {
        somebindings: '<'
      }
    });
    
    
    component2.coffee
        appModule.component('name', {
        templateUrl: '/public/partials/html2.html',
      controller: 'controler2',
      bindings: {
        somebindings: '<'
      }
    });
    

    Conclusion: "name" has to be unique in whole app.

提交回复
热议问题