I have a tree like structure, received as JSON from some PHP code which I wrote for my server.
The code is far to complex to post, so let's use an example:
A company has
- multiple departments, each of which has 0..n
- jobs, each of which has 0..n
- people
- jobs, each of which has 0..n
So, I can find myself with something like
$scope.departments[1].jobs[1].people[1]
$scope.departments[1].jobs[1].people[2]
etc
I have $scope variable for the current user-selected department, job and person.
My problem is where I want to use an ng-repeat of the jobs in the HTML view for the jobs.
The statement
<div ng-repeat="job in departments[{{departmentId}}].jobs>
gives Error: [$parse:syntax], as does
<div ng-repeat="job in departments[$scope.departmentId].jobs>
(which I tried in desperation).
What is the correct syntax?
I am wondering if I will need to try
<div ng-repeat="job in GetJobsForCurrentDepartment()>
since $scope.departmentId would be in scope in my controller, but is not in the HTML view for the departments.
departmentIdinGetJobsForCurrentDepartmentfunction like<div ng-repeat="job in GetJobsForCurrentDepartment(departmentId)>