Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Custom directive as root element of a directive template #10637

Closed
rraziel opened this issue Jan 4, 2015 · 1 comment
Closed

Custom directive as root element of a directive template #10637

rraziel opened this issue Jan 4, 2015 · 1 comment

Comments

@rraziel
Copy link

rraziel commented Jan 4, 2015

Hello,

I have the following 2 directives:

.directive('storageDirectoryTree', function() {
  return {
    replace: true,
    templateUrl: 'directory-tree.html'
  };
})
.directive('uiSection', function() {
  return {
    replace: true,
    templateUrl: 'section.html'
  };
})

And the following 2 HTML files (without the comments):

<!-- directory-tree.html -->
<ui-section>
  <h1> .. </h1>
  <div> .. </div>
</ui-section>

<!-- section.html -->
<div class="section">
  ..
</div>

And try to use it this way, getting the following error:

<storage-directory-tree>
  ..
</storage-directory-tree>
Error: [$compile:multidir] Multiple directives [storageDirectoryTree, uiSection] asking for template on: <ui-section>

I know that I can get it to work using {{replace: false}} but that would affect the HTML and thus the CSS, is there any way to achieve this while still replacing the elements?

@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 4, 2015

The quick answer is that this cannot be done. This is the same issue as #10612, so I will close this as a duplicate, as the limitation is the same

@lgalfaso lgalfaso closed this as completed Jan 4, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants