Answer the question
In order to leave comments, you need to log in
How to make a dynamic menu in Angular?
Hello.
There is a menu:
меню1
подменю1
подменю2
подменю3
т.д
меню2
подменю1
меню3
Answer the question
In order to leave comments, you need to log in
If you are asking about rendering in html, then ng-include with a template will help you. A single item template can be stored directly in your view in a script.
<script type="text/ng-template" id="category.html">
код элемента
</script>
<ul>
<li ng:repeat="category in categories" ng:include="'category.html'"></li>
</ul>
ID: {{category.id}},
NAME: {{category.name}}
<ul ng:if="category.children">
<li ng:repeat="category in $parent.category.children" ng:include="'category.html'"></li>
<!-- $parent нужен из-за ng-if -->
</ul>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question