2

I would like to create a nested directive structure in Angular like

<aa>
    <bb>
        <cc></cc>
    </bb>
    <bb>
        <cc></cc>
    </bb>
</aa>

Each directive would print its content, so aa tags will print "A", bb tags will print "B" and cc tags will print "C". The problem is that the outer directive overwrites the inner ones so only the first directive is processed.

Here's a Fiddle. What am I missing?

8
  • Why? Should cc specialize bb? Commented Dec 18, 2014 at 8:38
  • ng-controller's. Have them talk together through services that return a JSON object, if you need them to Commented Dec 18, 2014 at 8:38
  • @LutzHorn Consider aa tags like Continents, bb tags like states and cc tags like cities, this will give you an example.. Commented Dec 18, 2014 at 8:41
  • @J-Dizzle I don't want to use controllers for this, so that who writes HTML doesn't have to care about controllers and viceversa Commented Dec 18, 2014 at 8:42
  • @LucaDeNardi Could you please edit your question and add an example that gives us an idea of what you want to do? Commented Dec 18, 2014 at 8:43

1 Answer 1

4

You are missing the ng-transclude from the templates

See http://jsfiddle.net/x3420fg1/1/

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, I just found out it by myself before you answered :) This is the solution anyways!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.