I am still fairly new to angular so I was wondering how to best do something like this:
I have a json file that returns a variety of items of type 'course' and type 'tutorial'. Tutorials are related to courses with a field
data = [ { title: foo1, type: course, id:1}, { title: foo2, type: course, id:2}, { title: foo3, type: course, id:3}, { title: t1, type: tutorial, id:4, related_course:2}, { title: t2, type: tutorial, id:5, related_course:2}, { title: t3, type: tutorial, id:6, related_course:3}, ...
In my controller I have functions bound to $scope
to allow me to filter by type.
Now in my template
<div ng-repeat="item in data | filter:isCourse">
... display course data
<div ng-repeat="item in data | filter.isTutorial">
... display tutorial data
I would like to find a way to make sure the tutorials displayed match the id of the currently displayed course.
Any suggestions?
Thanks! - V