I'm just starting to learn AngularJS and I need to be able to create lists with a title and then items within it.
Category 1
Item 1
Item 2
Etc
Category 2
Item 1
Item 2
Etc
How can I create a loop to get the category title, and then also get the items within that category?
In the code I would like to display it like this:
<h2>Category 1</h2>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
I'm sorry I can't give more information, I don't know enough about the language to provide more. Thanks in advance!
Edit: I have tried:
$scope.categories = ['category 1', 'category 2']
<div ng-repeat="category in categories">
{{category}}
</div>
With this I dont know how to go another layer deep for the items.
Also I'm trying to do something like this (I don't know if it will work):
var categories = {$category: $items}
angular.forEach(categories, function(category, items)) {
//Do Something
}