Just starting out with angular and trying to figure out the best way to achieve this:
I have some data in a json file that includes items of two types: 'course' and 'tutorial'. Tutorials are related to courses through a specific 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've set up functions linked to $scope
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 want to ensure that the tutorials shown match the id of the currently displayed course. Any ideas on how to tackle this?
Appreciate any help! - V